summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/sysfs.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2017-12-28 00:05:52 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2018-01-17 00:39:58 +0100
commit7e65be49ed94f89cbf5add7dadf6e338f0cc6e7b (patch)
treeccea427a00e1202c15bfb7e23b4d0162e47fa233 /fs/f2fs/sysfs.c
parentf2fs: check segment type in __f2fs_replace_block (diff)
downloadlinux-7e65be49ed94f89cbf5add7dadf6e338f0cc6e7b.tar.xz
linux-7e65be49ed94f89cbf5add7dadf6e338f0cc6e7b.zip
f2fs: add reserved blocks for root user
This patch allows root to reserve some blocks via mount option. "-o reserve_root=N" means N x 4KB-sized blocks for root only. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/sysfs.c')
-rw-r--r--fs/f2fs/sysfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 93c3364250dd..ab6028c332aa 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -162,7 +162,8 @@ static ssize_t f2fs_sbi_store(struct f2fs_attr *a,
#endif
if (a->struct_type == RESERVED_BLOCKS) {
spin_lock(&sbi->stat_lock);
- if (t > (unsigned long)sbi->user_block_count) {
+ if (t > (unsigned long)(sbi->user_block_count -
+ sbi->root_reserved_blocks)) {
spin_unlock(&sbi->stat_lock);
return -EINVAL;
}