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

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

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:

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 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

Attachment: signature.asc
Description: OpenPGP digital signature

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