diff mbox series

[06/10] btrfs-progs: add some missing extent buffer helpers

Message ID 8c23286a4b3630e17540bcddce98eabebdf9c8a3.1681939107.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: prep work for syncing ctree.c | expand

Commit Message

Josef Bacik April 19, 2023, 9:20 p.m. UTC
The following are some extent buffer helpers we have in the kernel but
not in btrfs-progs.  Sync these in to make syncing ctree.c easier.

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

Patch

diff --git a/kernel-shared/extent_io.c b/kernel-shared/extent_io.c
index 01dc5b1e..f740b3a6 100644
--- a/kernel-shared/extent_io.c
+++ b/kernel-shared/extent_io.c
@@ -617,6 +617,12 @@  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)
 {
@@ -634,3 +640,8 @@  int extent_buffer_test_bit(const struct extent_buffer *eb, unsigned long start,
 {
 	return le_test_bit(nr, (u8 *)eb->data + start);
 }
+
+void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *srcv)
+{
+	write_extent_buffer(eb, srcv, btrfs_header_fsid(), BTRFS_FSID_SIZE);
+}
diff --git a/kernel-shared/extent_io.h b/kernel-shared/extent_io.h
index 69133c3c..103f93cb 100644
--- a/kernel-shared/extent_io.h
+++ b/kernel-shared/extent_io.h
@@ -114,6 +114,8 @@  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);
@@ -133,5 +135,6 @@  void extent_buffer_bitmap_set(struct extent_buffer *eb, unsigned long start,
                               unsigned long pos, unsigned long len);
 void extent_buffer_init_cache(struct btrfs_fs_info *fs_info);
 void extent_buffer_free_cache(struct btrfs_fs_info *fs_info);
+void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *srcv);
 
 #endif