[2/4] f2fs: relocate f2fs_precache_extents() in f2fs_swap_activate()

Message ID 20240226013208.2389246-2-chao@kernel.org
State New
Headers
Series [1/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks() |

Commit Message

Chao Yu Feb. 26, 2024, 1:32 a.m. UTC
  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>
---
 fs/f2fs/data.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Daeho Jeong Feb. 29, 2024, 5:41 p.m. UTC | #1
Reviewed-by: Daeho Jeong <daehojeong@google.com>

Thanks,

On Sun, Feb 25, 2024 at 5:33 PM Chao Yu <chao@kernel.org> wrote:
>
> 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>
> ---
>  fs/f2fs/data.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 0c728e82d936..bd8674bf1d84 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -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;
> --
> 2.40.1
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
  

Patch

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 0c728e82d936..bd8674bf1d84 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -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;