Skip to contentSkip to conversation

f2fs: move mnt_want_write_file after range check

PATCH In review Yunlei He 2 participants 2 messages Apr 24, 2018 – Apr 25, 2018 F2FS file system

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH v3 1/1 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.

---
 fs/f2fs/file.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
fs/f2fs/file.c +4 -5
index 16dad2b..6b79b8a 100644
@@ -2061,15 +2061,14 @@ 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))
+		return -EINVAL;
+
 	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)) {
Signature · 6 lines
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
maintainer Reviewed-by on v3 1/1
#1 lore raw
Quoted 4 lines · Yunlei He

This patch move mnt_want_write_file after range check, it's needless to check arguments with it.

Thanks,

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot