f2fs: relocate f2fs_precache_extents()
authorChao Yu <yuchao0@huawei.com>
Sat, 26 Dec 2020 10:07:41 +0000 (18:07 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 27 Jan 2021 23:20:01 +0000 (15:20 -0800)
Relocate f2fs_precache_extents() in prior to check_swap_activate(),
then extent cache can be enabled before its use.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c

index aa34d620bec9820227286068e6c6a582c7aa840c..57b9aab2b1426cc9a04ab83885f66b572f8188cf 100644 (file)
@@ -4108,12 +4108,13 @@ static int f2fs_swap_activate(struct swap_info_struct *sis, struct file *file,
        if (!f2fs_disable_compressed_file(inode))
                return -EINVAL;
 
+       f2fs_precache_extents(inode);
+
        ret = check_swap_activate(sis, file, span);
        if (ret < 0)
                return ret;
 
        set_inode_flag(inode, FI_PIN_FILE);
-       f2fs_precache_extents(inode);
        f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
        return ret;
 }