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

Re: [PATCH] Include journal size in ext3/ext4 existing size value.

On 05/13/2009 06:48 PM, Eric Sandeen wrote:
David Cantrell wrote:
For ext3 and ext4 filesystems, add the journal size to the value we get
from statvfs() and use that total for the existing size of the
filesystem.  Existing size is meant to be the amount of space occupied
by the filesystem on the volume, for journaled filesystems that means
there is a disconnect between what we get from statvfs() and how much
space the filesystem consumes on the volume.

FWIW, I don't think stat f_blocks + journal size adds up quite right
either :(  I don't know why.  I didn't write it ;)

I was talking to dlehman on irc tonight ... If you really want to know
the total blocks under the filesystem, for ext$FOO you can do:

# dumpe2fs -h $DEVICE  | grep "Block"
dumpe2fs 1.41.4 (27-Jan-2009)
Block count:              65536
Block size:               1024
Blocks per group:         8192

for xfs you can do:

# xfs_db $DEVICE -c "sb 0" -c "p dblocks" -c "p blocksize"
dblocks = 65536
blocksize = 1024

and those should be accurate for your purposes, if you want to know the
total nr of blocks that are under the filesystem's purview...

And this is what I originally did back in March, then you suggested using statfs() over reading these fields. I did change the patch and we liked that a lot more than doing this, but I did read these fields initially.

See these threads:


That's patches to do what you described above for ext2, ext3, ext4, ntfs, and jfs. And can add xfs with the information you just provided.

I'll update these patches to apply to the current code base.

David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI

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