[Libguestfs] virt-df: ext2/3/4 statvfs(2) output changed between two recent Linux kernels (3.2.0)
Jim Meyering
jim at meyering.net
Sun Nov 13 10:21:03 UTC 2011
Richard W.M. Jones wrote:
> [Jim, as coreutils developer, this might interest you]
>
> In libguestfs we run some quite detailed checks of the output of the
> statvfs system call for our tool "virt-df". I noticed that the output
> of virt-df changed slightly.
>
> Narrowing it down, the difference only happens between:
>
> Fedora kernel 3.2.0-0.rc0.git4.1.fc17 (3rd Nov)
> Fedora kernel 3.2.0-0.rc1.git2.1.fc17 (11th Nov)
>
> With 3.2.0-0.rc0.git4.1.fc17, and all earlier versions, the output of
> statvfs(2) on a freshly created 20M ext2 filesystem is:
>
> bsize: 1024
> frsize: 1024
> blocks: 19827 <-- NB
> bfree: 19655
> bavail: 18631
> files: 5136
> ffree: 5125
> favail: 5125
> fsid: 1411286354856931562
> flag: 4096
> namemax: 255
>
> With 3.2.0-0.rc1.git2.1.fc17, it changed to:
>
> bsize: 1024
> frsize: 1024
> blocks: 19939 <-- NB
Good catch!
> bfree: 19655
> bavail: 18631
> files: 5136
> ffree: 5125
> favail: 5125
> fsid: -9088586685126948527
> flag: 4096
> namemax: 255
>
> I am able to demonstrate the difference by keeping every other package
> identical, and just booting the two different kernels. As far as I
> know, everything else including e2fsprogs is completely identical.
>
> Reproducer:
> export FEBOOTSTRAP_KERNEL=/boot/vmlinuz-<version>
> guestfish sparse /tmp/test.img 20M : run : \
> mkfs ext2 /dev/sda : mount /dev/sda / : statvfs /
>
> I tracked this down to the way the filesystem overhead is calculated.
> It changed slightly in the commit below. The description seems to be
> wrong; it seems to affect any filesystem going through the ext4 driver
> (this driver is used for ext2 & ext3 in recent Fedora), and doesn't
> appear to have anything to do with 'bigalloc'.
>
> commit f975d6bcc7a698a10cc755115e27d3612dcfe322
> Author: Theodore Ts'o <tytso at mit.edu>
> Date: Fri Sep 9 19:00:51 2011 -0400
>
> ext4: teach ext4_statfs() to deal with clusters if bigalloc is enabled
Nice detective work.
Even if it's only a mere 0.5% difference, it seems like
something that should be announced more clearly -- that is,
assuming it was indeed intended. If bigalloc-related changes
should not induce such changes in an ext2 file system, then
maybe it's a bug.
More information about the Libguestfs
mailing list