f2fs: stop repeated checking if cp is needed
authorChangman Lee <cm224.lee@samsung.com>
Thu, 31 Jan 2013 08:16:56 +0000 (17:16 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 11 Feb 2013 22:15:01 +0000 (07:15 +0900)
If it is decided that f2fs should do checkpoint, skip next comparison.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
fs/f2fs/file.c

index 3efa4739b00cceeb1e26d53ac22513fe77376555..33d1736ee5f954da1db38ae06b2d7667b06b57dc 100644 (file)
@@ -157,11 +157,11 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 
        if (!S_ISREG(inode->i_mode) || inode->i_nlink != 1)
                need_cp = true;
-       if (is_inode_flag_set(F2FS_I(inode), FI_NEED_CP))
+       else if (is_inode_flag_set(F2FS_I(inode), FI_NEED_CP))
                need_cp = true;
-       if (!space_for_roll_forward(sbi))
+       else if (!space_for_roll_forward(sbi))
                need_cp = true;
-       if (need_to_sync_dir(sbi, inode))
+       else if (need_to_sync_dir(sbi, inode))
                need_cp = true;
 
        if (need_cp) {