From: Qu Wenruo Date: Sat, 15 Jul 2023 11:08:32 +0000 (+0800) Subject: btrfs: copy all pages at once at the end of btrfs_clone_extent_buffer() X-Git-Tag: v6.6-rc1~207^2~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=682a0bc5573f3c10a435fb9650c856bb325d2733;p=thirdparty%2Fkernel%2Flinux.git btrfs: copy all pages at once at the end of btrfs_clone_extent_buffer() btrfs_clone_extent_buffer() calls copy_page() at each iteration but we can copy all pages at the end in one go if there were no errors. This would make later conversion to folios easier. Reviewed-by: Sweet Tea Dorminy Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 1ba8857a8dbed..3e30333a4c6be 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3239,8 +3239,8 @@ struct extent_buffer *btrfs_clone_extent_buffer(const struct extent_buffer *src) return NULL; } WARN_ON(PageDirty(p)); - copy_page(page_address(p), page_address(src->pages[i])); } + copy_extent_buffer_full(new, src); set_extent_buffer_uptodate(new); return new;