diff mbox series

[31/38] btrfs-progs: update btrfs_del_ptr to match the kernel

Message ID ccae066a07bd30b0a58b2d1ebdf25ba07ffef6ca.1692800904.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 Aug. 23, 2023, 2:32 p.m. UTC
The kernel version of btrfs_del_ptr takes a trans handle as an argument
and returns an error in the case of tree-mod-log, update our version to
match to make syncing ctree.c more straightforward.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 check/main.c          |  4 ++--
 kernel-shared/ctree.c | 12 +++++++-----
 kernel-shared/ctree.h |  4 ++--
 3 files changed, 11 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/check/main.c b/check/main.c
index 08c49f7a..04c965ab 100644
--- a/check/main.c
+++ b/check/main.c
@@ -3569,7 +3569,7 @@  static int repair_btree(struct btrfs_root *root,
 					     path.slots[level]);
 
 		/* Remove the ptr */
-		btrfs_del_ptr(root, &path, level, path.slots[level]);
+		btrfs_del_ptr(trans, root, &path, level, path.slots[level]);
 
 		/*
 		 * Remove the corresponding extent
@@ -7828,7 +7828,7 @@  again:
 
 del_ptr:
 	printk("deleting pointer to block %llu\n", corrupt->cache.start);
-	btrfs_del_ptr(extent_root, &path, level, slot);
+	btrfs_del_ptr(trans, extent_root, &path, level, slot);
 
 out:
 	btrfs_release_path(&path);
diff --git a/kernel-shared/ctree.c b/kernel-shared/ctree.c
index c3b86e2e..47938f01 100644
--- a/kernel-shared/ctree.c
+++ b/kernel-shared/ctree.c
@@ -855,7 +855,7 @@  static noinline int balance_level(struct btrfs_trans_handle *trans,
 			btrfs_clear_buffer_dirty(trans, right);
 			free_extent_buffer(right);
 			right = NULL;
-			btrfs_del_ptr(root, path, level + 1, pslot + 1);
+			btrfs_del_ptr(trans, root, path, level + 1, pslot + 1);
 
 			root_sub_used(root, blocksize);
 			wret = btrfs_free_extent(trans, bytenr, blocksize, 0,
@@ -900,7 +900,7 @@  static noinline int balance_level(struct btrfs_trans_handle *trans,
 		btrfs_clear_buffer_dirty(trans, mid);
 		free_extent_buffer(mid);
 		mid = NULL;
-		btrfs_del_ptr(root, path, level + 1, pslot);
+		btrfs_del_ptr(trans, root, path, level + 1, pslot);
 
 		root_sub_used(root, blocksize);
 		wret = btrfs_free_extent(trans, bytenr, blocksize, 0,
@@ -2711,8 +2711,8 @@  int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root
  * continuing all the way the root if required.  The root is converted into
  * a leaf if all the nodes are emptied.
  */
-void btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path,
-		int level, int slot)
+int btrfs_del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
+		  struct btrfs_path *path, int level, int slot)
 {
 	struct extent_buffer *parent = path->nodes[level];
 	u32 nritems;
@@ -2739,6 +2739,8 @@  void btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path,
 		fixup_low_keys(path, &disk_key, level + 1);
 	}
 	btrfs_mark_buffer_dirty(parent);
+
+	return 0;
 }
 
 /*
@@ -2759,7 +2761,7 @@  static noinline int btrfs_del_leaf(struct btrfs_trans_handle *trans,
 	int ret;
 
 	WARN_ON(btrfs_header_generation(leaf) != trans->transid);
-	btrfs_del_ptr(root, path, 1, path->slots[1]);
+	btrfs_del_ptr(trans, root, path, 1, path->slots[1]);
 
 	root_sub_used(root, leaf->len);
 
diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index ce2122d7..d15c16c0 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -945,8 +945,8 @@  int btrfs_convert_one_bg(struct btrfs_trans_handle *trans, u64 bytenr);
 
 /* ctree.c */
 int btrfs_comp_cpu_keys(const struct btrfs_key *k1, const struct btrfs_key *k2);
-void btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path,
-		int level, int slot);
+int btrfs_del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
+		  struct btrfs_path *path, int level, int slot);
 struct extent_buffer *btrfs_read_node_slot(struct extent_buffer *parent,
 					   int slot);
 int btrfs_previous_item(struct btrfs_root *root,