Commit b08b12d2 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: fix incorrect free inode count in ->statfs

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: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent b4ceec29
...@@ -852,7 +852,8 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -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_bavail = user_block_count - valid_user_blocks(sbi);
buf->f_files = sbi->total_node_count - F2FS_RESERVED_NODE_NUM; 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_namelen = F2FS_NAME_LEN;
buf->f_fsid.val[0] = (u32)id; buf->f_fsid.val[0] = (u32)id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment