Skip to content

Commit 8d0c7ea

Browse files
chaseyupundiramit
authored andcommitted
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>
1 parent 4816405 commit 8d0c7ea

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/f2fs/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,8 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
852852
buf->f_bavail = user_block_count - valid_user_blocks(sbi);
853853

854854
buf->f_files = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
855-
buf->f_ffree = buf->f_files - valid_inode_count(sbi);
855+
buf->f_ffree = min(buf->f_files - valid_node_count(sbi),
856+
buf->f_bavail);
856857

857858
buf->f_namelen = F2FS_NAME_LEN;
858859
buf->f_fsid.val[0] = (u32)id;

0 commit comments

Comments
 (0)