aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-06-26 16:24:41 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2017-07-07 10:34:41 -0700
commitdaeb433e42de97c79622f58681972200eec1d8da (patch)
treeb0f24b7eb9f345be975c63af9513c275f777da1b /fs/f2fs/super.c
parentf2fs: avoid redundant f2fs_flush after remount (diff)
downloadlinux-dev-daeb433e42de97c79622f58681972200eec1d8da.tar.xz
linux-dev-daeb433e42de97c79622f58681972200eec1d8da.zip
f2fs: introduce reserved_blocks in sysfs
In this patch, we add a new sysfs interface, with it, we can control number of reserved blocks in system which could not be used by user, it enable f2fs to let user to configure for adjusting over-provision ratio dynamically instead of changing it by mkfs. So we can expect it will help to reserve more free space for relieving GC in both filesystem and flash device. Signed-off-by: Chao Yu <yuchao0@huawei.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, 3 insertions, 1 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 3da6fb276f8b..c45bac6f1795 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -691,7 +691,8 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
buf->f_blocks = total_count - start_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_bavail = user_block_count - valid_user_blocks(sbi) -
+ sbi->reserved_blocks;
avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
@@ -1768,6 +1769,7 @@ try_onemore:
sbi->total_valid_block_count =
le64_to_cpu(sbi->ckpt->valid_block_count);
sbi->last_valid_block_count = sbi->total_valid_block_count;
+ sbi->reserved_blocks = 0;
for (i = 0; i < NR_INODE_TYPE; i++) {
INIT_LIST_HEAD(&sbi->inode_list[i]);