diff mbox series

[24/26] btrfs-progs: add write_extent_buffer_chunk_tree_uuid helper

Message ID 046464e2ca6e3ba086cbf82bdc7c8c143a17251c.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
This exists in the kernel to update the chunk tree uuid on the
btrfs_header.  Add the helper to btrfs-progs to make future kernel sync
changes easier.

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

Patch

diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index b68a8080..376b8eca 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -731,7 +731,7 @@  static inline unsigned long btrfs_header_fsid(void)
 	return offsetof(struct btrfs_header, fsid);
 }
 
-static inline unsigned long btrfs_header_chunk_tree_uuid(struct extent_buffer *eb)
+static inline unsigned long btrfs_header_chunk_tree_uuid(const struct extent_buffer *eb)
 {
 	return offsetof(struct btrfs_header, chunk_tree_uuid);
 }
diff --git a/kernel-shared/extent_io.c b/kernel-shared/extent_io.c
index fbf45e9d..e942a7b4 100644
--- a/kernel-shared/extent_io.c
+++ b/kernel-shared/extent_io.c
@@ -659,6 +659,13 @@  void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *srcv)
 	write_extent_buffer(eb, srcv, btrfs_header_fsid(), BTRFS_FSID_SIZE);
 }
 
+void write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb,
+		const void *srcv)
+{
+	write_extent_buffer(eb, srcv, btrfs_header_chunk_tree_uuid(eb),
+			    BTRFS_FSID_SIZE);
+}
+
 /*
  * btrfs_readahead_node_child - readahead a node's child block
  * @node:	parent node we're reading from
diff --git a/kernel-shared/extent_io.h b/kernel-shared/extent_io.h
index 544d5710..aa56c115 100644
--- a/kernel-shared/extent_io.h
+++ b/kernel-shared/extent_io.h
@@ -143,5 +143,7 @@  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);
 void btrfs_readahead_node_child(struct extent_buffer *node, int slot);
+void write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb,
+		const void *src);
 
 #endif