From: NeilBrown Date: Sat, 5 Mar 2011 00:25:20 +0000 (+1100) Subject: Small fix for 'df' on subset filesystems X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=12df19d015e1c70e844193aa390576d32df10ca5;p=LaFS.git Small fix for 'df' on subset filesystems 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 --- diff --git a/super.c b/super.c index f6f66c7..68f0c35 100644 --- 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,