[libvirt] [PATCH] storage: use f_frsize, not f_bsize, for calculating available space

Eric Blake eblake at redhat.com
Sat Feb 23 00:05:10 UTC 2013


On 02/22/2013 04:43 PM, Sage Weil wrote:
> The bfree and blocks fields are supposed to be in units of frsize.  We were
> calculating capacity correctly using those units, but the available
> calculation was using bsize instead.  Most file systems report these as the
> same value specifically because many programs are buggy, but that is no
> reason to rely on that behavior, or to behave inconsistently.

I checked POSIX as a reference:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_statvfs.h.html#tag_13_63

unsigned long f_bsize    File system block size.
unsigned long f_frsize   Fundamental file system block size.
fsblkcnt_t    f_blocks   Total number of blocks on file system in units
of f_frsize.
fsblkcnt_t    f_bfree    Total number of free blocks.

> 
> This bug has been present since e266ded (2008) and aa296e6c, when the code
> was originally introduced (the latter via cut and paste).
> 
> Signed-off-by: Sage Weil <sage at newdream.net>
> ---
>  src/parallels/parallels_storage.c |    2 +-
>  src/storage/storage_backend_fs.c  |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

ACK and pushed.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130222/5a994e1a/attachment-0001.sig>


More information about the libvir-list mailing list