]> git.neil.brown.name Git - LaFS.git/commitdiff
Small fix for 'df' on subset filesystems
authorNeilBrown <neilb@suse.de>
Sat, 5 Mar 2011 00:25:20 +0000 (11:25 +1100)
committerNeilBrown <neilb@suse.de>
Sat, 5 Mar 2011 00:25:20 +0000 (11:25 +1100)
We should never report more available space than free space.

'free' space might be limited by the blocks_allowed, while
the 'available' space calculation is for the total filesystem.
So if free is actually less than the calculated 'available', we must
reduce the 'available'.

Signed-off-by: NeilBrown <neilb@suse.de>
super.c

diff --git a/super.c b/super.c
index f6f66c75224d39010be0f4e5fc06c13d6a6b1800..68f0c35d2a7d76a2cf02038fff9560da41a4abd7 100644 (file)
--- a/super.c
+++ b/super.c
@@ -1414,6 +1414,8 @@ static int lafs_statfs(struct dentry *de, struct kstatfs *buf)
        buf->f_bfree = buf->f_blocks - (fsroot->md.fs.cblocks_used +
                                        fsroot->md.fs.pblocks_used +
                                        fsroot->md.fs.ablocks_used);
+       if (buf->f_bfree < buf->f_bavail)
+               buf->f_bavail = buf->f_bfree;
        dprintk("df: tot=%ld free=%ld avail=%ld(%ld-%ld-%ld) cb=%ld pb=%ld ab=%ld\n",
                (long)buf->f_blocks, (long)buf->f_bfree, (long)buf->f_bavail,
                (long)fs->free_blocks, (long)fs->clean_reserved,