Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1437449 > unrolled thread

[PATCH] f2fs: fix incorrect f_bfree calculation in ->statfs

Started byChao Yu <yuchao0@huawei.com>
First post2016-07-06 08:20 +0200
Last post2016-07-06 08:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] f2fs: fix incorrect f_bfree calculation in ->statfs Chao Yu <yuchao0@huawei.com> - 2016-07-06 08:20 +0200

#1437449 — [PATCH] f2fs: fix incorrect f_bfree calculation in ->statfs

FromChao Yu <yuchao0@huawei.com>
Date2016-07-06 08:20 +0200
Subject[PATCH] f2fs: fix incorrect f_bfree calculation in ->statfs
Message-ID<rROlI-5yI-19@gated-at.bofh.it>
As manual described, f_bfree indicates total free blocks in fs, in f2fs, it
includes two parts: visible free blocks and over-provision blocks. This
patch corrrects the calculation.

fsblkcnt_t   f_bfree;   /* free blocks in fs */

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 36118cf..f468381 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -816,7 +816,7 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	buf->f_bsize = sbi->blocksize;
 
 	buf->f_blocks = total_count - start_count;
-	buf->f_bfree = buf->f_blocks - valid_user_blocks(sbi) - ovp_count;
+	buf->f_bfree = user_block_count - valid_user_blocks(sbi) + ovp_count;
 	buf->f_bavail = user_block_count - valid_user_blocks(sbi);
 
 	buf->f_files = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
-- 
2.8.2.311.gee88674

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web