[libvirt] [PATCH 3/3] Add volume zeroing

Daniel P. Berrange berrange at redhat.com
Tue Feb 16 11:33:55 UTC 2010


On Mon, Feb 15, 2010 at 10:47:33PM +0100, Paolo Bonzini wrote:
> On 02/15/2010 10:29 PM, David Allan wrote:
> >* If the volume is a sparse file and the fiemap ioctl is available,
> >use fiemap to locate the volume's extents.
> 
> What about for a sparse file doing just
> 
>   ftruncate (fd, 0);
>   ftruncate (fd, st.st_size);
> 
> ?
> 
> It's already sparse, it doesn't hurt to make it _more_ sparse.

The idea of zeroing upon delete, is that we want the currently allocated
extents to be overwritten with zeros. If we truncate to 0 size, then
extend to original size I imagine that would easily allow the filesystem
to give you a new set of extents filled with zeros, leaving the old
extents with data intact as unused space on the FS.

Also, we need to make sure that this code works with physical block
devices, as well as plain files. You can't truncate a block device so
we'll need to write zeros in that case anyway.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list