>-----Original Message----- >From: heyunlei >Sent: Monday, April 23, 2018 10:37 AM >To: jaeg...@kernel.org; Yuchao (T); linux-f2fs-devel@lists.sourceforge.net >Cc: Wangbintian; heyunlei; Zhangdianfang (Euler) >Subject: [f2fs-dev][PATCH] f2fs: move mnt_want_write_file after range check > >This patch move mnt_want_write_file after range check, >it's needless to check arguments with it. > >Signed-off-by: Yunlei He <heyun...@huawei.com> >--- > fs/f2fs/file.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > >diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c >index 16dad2b..165a60f 100644 >--- a/fs/f2fs/file.c >+++ b/fs/f2fs/file.c >@@ -2061,15 +2061,18 @@ static int f2fs_ioc_gc_range(struct file *filp, >unsigned long arg) > if (f2fs_readonly(sbi->sb)) > return -EROFS; > >+ end = range.start + range.len; >+ if (range.start < MAIN_BLKADDR(sbi) || end >= MAX_BLKADDR(sbi)) { >+ f2fs_msg(sbi->sb, KERN_WARNING, >+ "range should be located in (%u, %u]", >+ MAIN_BLKADDR(sbi), MAX_BLKADDR(sbi)); >+ return -EINVAL; >+ }
Okay, btw, should we combine f2fs_ioc_gc and f2fs_ioc_gc_range? we can add a value in input arguments to indicate whether it's range gc or not. Thanks. >+ > ret = mnt_want_write_file(filp); > if (ret) > return ret; > >- end = range.start + range.len; >- if (range.start < MAIN_BLKADDR(sbi) || end >= MAX_BLKADDR(sbi)) { >- ret = -EINVAL; >- goto out; >- } > do_more: > if (!range.sync) { > if (!mutex_trylock(&sbi->gc_mutex)) { >-- >1.9.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel