diff options
| author | Chao Yu <yuchao0@huawei.com> | 2016-11-18 22:27:41 +0800 |
|---|---|---|
| committer | Jaegeuk Kim <jaegeuk@google.com> | 2017-09-25 15:36:59 -0700 |
| commit | a680707a3f4161761e35effaedbdba02ee7ee069 (patch) | |
| tree | 3581dc241b232c51715ae528c4496f35d018f116 | |
| parent | 23eb5177568d70646669871d2268106947630990 (diff) | |
f2fs: fix incorrect free inode count in ->statfs
commit b08b12d2ddc85b977a0531470cf6a7158289aaaf upstream.
While calculating inode count that we can create at most in the left space,
we should consider space which data/node blocks occupied, since we create
data/node mixly in main area. So fix the wrong calculation in ->statfs.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
| -rw-r--r-- | fs/f2fs/super.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 2d332a16de71..a288456c17c0 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -852,7 +852,8 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) buf->f_bavail = user_block_count - valid_user_blocks(sbi); buf->f_files = sbi->total_node_count - F2FS_RESERVED_NODE_NUM; - buf->f_ffree = buf->f_files - valid_inode_count(sbi); + buf->f_ffree = min(buf->f_files - valid_node_count(sbi), + buf->f_bavail); buf->f_namelen = F2FS_NAME_LEN; buf->f_fsid.val[0] = (u32)id; |
