summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
authorChao Yu2014-08-20 12:36:46 +0200
committerJaegeuk Kim2014-08-21 22:57:06 +0200
commitc200b1aa6cb460ce8c3ecf6fdc690d3949c3cc5d (patch)
tree527fda78fcfcd4a879766e3c38cf8041fc10f1e8 /fs/f2fs/super.c
parentf2fs: remove rename and use rename2 (diff)
downloadkernel-qcow2-linux-c200b1aa6cb460ce8c3ecf6fdc690d3949c3cc5d.tar.gz
kernel-qcow2-linux-c200b1aa6cb460ce8c3ecf6fdc690d3949c3cc5d.tar.xz
kernel-qcow2-linux-c200b1aa6cb460ce8c3ecf6fdc690d3949c3cc5d.zip
f2fs: fix incorrect calculation with total/free inode num
Theoretically, our total inodes number is the same as total node number, but there are three node ids are reserved in f2fs, they are 0, 1 (node nid), and 2 (meta nid), and they should never be used by user, so our total/free inode number calculated in ->statfs is wrong. This patch indroduces F2FS_RESERVED_NODE_NUM and then fixes this issue by recalculating total/free inode number with the macro. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r--fs/f2fs/super.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index ddb1e9d36363..0f61f5aa587c 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -508,8 +508,8 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
buf->f_bfree = buf->f_blocks - valid_user_blocks(sbi) - ovp_count;
buf->f_bavail = user_block_count - valid_user_blocks(sbi);
- buf->f_files = sbi->total_node_count;
- buf->f_ffree = sbi->total_node_count - valid_inode_count(sbi);
+ buf->f_files = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
+ buf->f_ffree = buf->f_files - valid_inode_count(sbi);
buf->f_namelen = F2FS_NAME_LEN;
buf->f_fsid.val[0] = (u32)id;