[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [et-mgmt-tools] [PATCH][virtinst] support for cloning a sparse file



On Thu, May 24, 2007 at 08:15:28PM +0900, Kazuki Mizushima wrote:
> >>Now, I investigate sparse files copying.
> >
> >There's no easy way to detect if a file is sparse - particularly in python.
> >I think the best option is to detect sequences of zeros. eg, if you are
> >reading the source file 4096  bytes at a time, check to see if that 4096
> >set of bytes are all zeros. If they are, then seek() forward 4096 bytes
> >instead of writing the set of zeros.
> 
> When copying a sparse file, I change read/write buffer to 4096 because it 
> is 4096 in cp.c. And I add the "--nonsparse" option as virt-install. 
> Default behavior is creating a sparse. Basically when destination file/disk 
> doesn't
> exist, create a sparse file and do sparselly copying (means lseek when 
> detecting
> 4096 sequences of zeros) to that sparse file. When destination file exists, 
> do non-sparselly copying(means no lseek when detecting 4096 sequences of 
> zeros)
> to the existing file.
> 
> In the above-mentioned, as a result of measuring the performance of copying 
> a sparse, I get the performance equivalent to the command of 'cp 
> --sparse=always'.

Thanks, I have comitted this patch.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]