f2fs: relocate f2fs_precache_extents() in f2fs_swap_activate()
authorChao Yu <chao@kernel.org>
Mon, 26 Feb 2024 01:32:06 +0000 (09:32 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 4 Mar 2024 17:51:52 +0000 (09:51 -0800)
This patch exchangs position of f2fs_precache_extents() and
filemap_fdatawrite(), so that f2fs_precache_extents() can load
extent info after physical addresses of all data are fixed.

Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c

index 0c728e82d9367e44890b30d43eac1a8d2263dfd9..bd8674bf1d8428a29487cb9bdd612f74ae831542 100644 (file)
@@ -4045,12 +4045,12 @@ 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 = filemap_fdatawrite(inode->i_mapping);
        if (ret < 0)
                return ret;
 
+       f2fs_precache_extents(inode);
+
        ret = check_swap_activate(sis, file, span);
        if (ret < 0)
                return ret;