summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorChao Yu2018-01-17 09:31:38 +0100
committerJaegeuk Kim2018-01-22 23:56:53 +0100
commitbb9e3bb8dbf5975a493e4e2dfbb900018579890c (patch)
treee2197b4ef49b7e928bf289f89e7267e15cecc6a9 /fs/f2fs/file.c
parentf2fs: fix to update last_disk_size correctly (diff)
downloadkernel-qcow2-linux-bb9e3bb8dbf5975a493e4e2dfbb900018579890c.tar.gz
kernel-qcow2-linux-bb9e3bb8dbf5975a493e4e2dfbb900018579890c.tar.xz
kernel-qcow2-linux-bb9e3bb8dbf5975a493e4e2dfbb900018579890c.zip
f2fs: split need_inplace_update
This patch splits need_inplace_update to two functions: a. should_update_inplace() includes all conditions that we must use IPU. b. should_update_outplace() includes all conditions that we must use OPU. So that, in f2fs_ioc_set_pin_file() and f2fs_defragment_range(), we can use corresponding function to check whether we can trigger OPU/IPU or not. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 9553f80dc677..f31f0590cdc7 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2082,7 +2082,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
int err;
/* if in-place-update policy is enabled, don't waste time here */
- if (need_inplace_update_policy(inode, NULL))
+ if (should_update_inplace(inode, NULL))
return -EINVAL;
pg_start = range->start >> PAGE_SHIFT;
@@ -2716,6 +2716,11 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg)
inode_lock(inode);
+ if (should_update_outplace(inode, NULL)) {
+ ret = -EINVAL;
+ goto out;
+ }
+
if (!pin) {
clear_inode_flag(inode, FI_PIN_FILE);
F2FS_I(inode)->i_gc_failures = 1;