From f094e35d633e445e1ba89518cdcc45d367ed0486 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 27 Jun 2023 16:20:30 +0200 Subject: [PATCH] btrfs-progs: kernel-shared: use copy_extent_buffer_full where possible We already have the helper for full extent buffer copy but don't use it everywhere. Signed-off-by: David Sterba --- kernel-shared/ctree.c | 4 ++-- kernel-shared/extent_io.c | 14 +++++++------- kernel-shared/extent_io.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/kernel-shared/ctree.c b/kernel-shared/ctree.c index ba474238..a8084a56 100644 --- a/kernel-shared/ctree.c +++ b/kernel-shared/ctree.c @@ -321,7 +321,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans, return PTR_ERR(cow); } - copy_extent_buffer(cow, buf, 0, 0, cow->len); + copy_extent_buffer_full(cow, buf); btrfs_set_header_bytenr(cow, cow->start); btrfs_set_header_generation(cow, trans->transid); btrfs_set_header_backref_rev(cow, BTRFS_MIXED_BACKREF_REV); @@ -622,7 +622,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, if (IS_ERR(cow)) return PTR_ERR(cow); - copy_extent_buffer(cow, buf, 0, 0, cow->len); + copy_extent_buffer_full(cow, buf); btrfs_set_header_bytenr(cow, cow->start); btrfs_set_header_generation(cow, trans->transid); btrfs_set_header_backref_rev(cow, BTRFS_MIXED_BACKREF_REV); diff --git a/kernel-shared/extent_io.c b/kernel-shared/extent_io.c index 7f6d592a..e304ae47 100644 --- a/kernel-shared/extent_io.c +++ b/kernel-shared/extent_io.c @@ -157,7 +157,7 @@ struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src) if (!new) return NULL; - copy_extent_buffer(new, src, 0, 0, src->len); + copy_extent_buffer_full(new, src); new->flags |= EXTENT_BUFFER_DUMMY; return new; @@ -615,6 +615,12 @@ void write_extent_buffer(const struct extent_buffer *eb, const void *src, memcpy((void *)eb->data + start, src, len); } +void copy_extent_buffer_full(const struct extent_buffer *dst, + const struct extent_buffer *src) +{ + copy_extent_buffer(dst, src, 0, 0, src->len); +} + void copy_extent_buffer(const struct extent_buffer *dst, const struct extent_buffer *src, unsigned long dst_offset, unsigned long src_offset, @@ -623,12 +629,6 @@ void copy_extent_buffer(const struct extent_buffer *dst, memcpy((void *)dst->data + dst_offset, src->data + src_offset, len); } -void copy_extent_buffer_full(const struct extent_buffer *dst, - const struct extent_buffer *src) -{ - copy_extent_buffer(dst, src, 0, 0, src->len); -} - void memmove_extent_buffer(const struct extent_buffer *dst, unsigned long dst_offset, unsigned long src_offset, unsigned long len) { diff --git a/kernel-shared/extent_io.h b/kernel-shared/extent_io.h index b6c30eef..413eef9f 100644 --- a/kernel-shared/extent_io.h +++ b/kernel-shared/extent_io.h @@ -111,12 +111,12 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dst, unsigned long start, unsigned long len); void write_extent_buffer(const struct extent_buffer *eb, const void *src, unsigned long start, unsigned long len); +void copy_extent_buffer_full(const struct extent_buffer *dst, + const struct extent_buffer *src); void copy_extent_buffer(const struct extent_buffer *dst, const struct extent_buffer *src, unsigned long dst_offset, unsigned long src_offset, unsigned long len); -void copy_extent_buffer_full(const struct extent_buffer *dst, - const struct extent_buffer *src); void memmove_extent_buffer(const struct extent_buffer *dst, const unsigned long dst_offset, unsigned long src_offset, unsigned long len);