[libvirt] [PATCH 3/4] vol-info: Check for NFS FS type

Ján Tomko jtomko at redhat.com
Fri Aug 8 11:07:48 UTC 2014


On 08/05/2014 04:38 PM, John Ferlan wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1077068
> 
> Check for the NFS FS type being true for a "local" stat of the file
> to force usage of the 'st_size' value rather than calculating the size
> using the 'st_blocks' and 'st_blksize'.  As described in the stat(2)
> man page:
> 
> "Use of the st_blocks and st_blksize fields may be less portable."
> 
> experimentation shows a 10M file could get the following output from stat:
> 
>   st_size=10485760 st_blocks=88 st_blksize=1048576
> 
> resulting in a "44 KiB" value being displayed as the allocation value.
> While this value does match the "du -s" value of the same file, the
> "du -b" value shows the "st_size" field. Similarly a long listing of the
> file shows the 10M size.

Capacity should be the apparent size (what du -b shows, or st_size), while
allocation should track the on-disk usage (du, st_blocks * 512).

It looks to me that the values are correct, it's just that posix_fallocate
does neither work nor fail on NFS.

Jan

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


More information about the libvir-list mailing list