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

Re: [libvirt] [PATCH] Fix sparse volume allocation reporting



On Tue, Mar 24, 2009 at 03:29:21PM -0400, Cole Robinson wrote:
> I have a sparse volume with a capacity of 1000M, and an allocation of a
> little over 750M. 'du' prints the correct sizes, but 'virsh vol-dumpxml'
> shows:
> 
>     <capacity>1048576000</capacity>
>   <allocation>6406307840</allocation>
> 
> This is because we were calculating the allocation size using the
> requested fs block size, instead of what stat actually uses as a block
> size (DEV_BSIZE in sys/params.h). sys/params.h looks to be present in
> mingw32-runtime, so I didn't add a configure check for it.

  That's weird but the mistake is understandable.
The man page (Fedora 9 maybe it was updated) states:

-----------------------------------------------------------------
      The st_blocks field indicates the number of  blocks  allocated to  the
      file,  512-byte  units.  (This may be smaller than st_size/512 when the
      file has holes.)
-----------------------------------------------------------------

  that's even worse I think.

> The attached patch fixes allocation listing for me.

  Looks fine to me, I wonder if that will work correctly on solaris for
example.
  Coding wise I'm just a bit surprized with the declaration in the
middle of a block, but I probably need to get over it :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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