diff mbox series

[12/26] btrfs-progs: sync memcpy_extent_buffer from the kernel

Message ID 1d11e9325887ccea1978e6c34868539b373fd252.1682799405.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: sync ctree.c into btrfs-progs | expand

Commit Message

Josef Bacik April 29, 2023, 8:19 p.m. UTC
We use this in ctree.c in the kernel, so sync this helper into
btrfs-progs to make sync'ing ctree.c easier.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 kernel-shared/extent_io.c | 6 ++++++
 kernel-shared/extent_io.h | 3 +++
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/kernel-shared/extent_io.c b/kernel-shared/extent_io.c
index e38bb1ed..fbf45e9d 100644
--- a/kernel-shared/extent_io.c
+++ b/kernel-shared/extent_io.c
@@ -630,6 +630,12 @@  void copy_extent_buffer_full(const struct extent_buffer *dst,
 	copy_extent_buffer(dst, src, 0, 0, src->len);
 }
 
+void memcpy_extent_buffer(const struct extent_buffer *dst, unsigned long dst_offset,
+			  unsigned long src_offset, unsigned long len)
+{
+	memcpy((void *)dst->data + dst_offset, dst->data + src_offset, 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 f573a4e2..544d5710 100644
--- a/kernel-shared/extent_io.h
+++ b/kernel-shared/extent_io.h
@@ -118,6 +118,9 @@  void copy_extent_buffer(const struct extent_buffer *dst,
 			unsigned long len);
 void copy_extent_buffer_full(const struct extent_buffer *dst,
 			     const struct extent_buffer *src);
+void memcpy_extent_buffer(const struct extent_buffer *dst,
+			  unsigned long dst_offset, unsigned long src_offset,
+			  unsigned long len);
 void memmove_extent_buffer(const struct extent_buffer *dst,
 			   const unsigned long dst_offset,
 			   unsigned long src_offset, unsigned long len);