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

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

On 02/15/2010 04:47 PM, 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.


That's a good point. The only thing that makes me hesitate is that I'm not certain that the file is guaranteed to contain zeros following the second call to ftruncate, and I'm having trouble coming up with the relevant spec at the moment.

This question might be academic in any case, since the volume zeroing is part of volume deletion, so we're talking about the case of a volume represented by a regular file on a backend that doesn't support volume delete. I'm not sure such a case exists. If that's so, we could just skip the whole zeroing operation entirely for regular files.


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