diff mbox series

[09/11] btrfs-progs: remove fs_info argument from btrfs_check_* helpers

Message ID 76907ec19d13a8bd8bb3ab860b5e7f1450716170.1681938648.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: prep work for syncing files into kernel-shared | expand

Commit Message

Josef Bacik April 19, 2023, 9:13 p.m. UTC
This can be pulled out of the extent buffer that is passed in, drop the
fs_info argument from the function.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 check/main.c            | 12 ++++++------
 check/mode-lowmem.c     | 10 +++++-----
 kernel-shared/ctree.c   | 12 ++++++------
 kernel-shared/ctree.h   |  6 ++----
 kernel-shared/disk-io.c |  4 ++--
 5 files changed, 21 insertions(+), 23 deletions(-)
diff mbox series

Patch

diff --git a/check/main.c b/check/main.c
index 1a9ad50c..8c3a10a1 100644
--- a/check/main.c
+++ b/check/main.c
@@ -1921,9 +1921,9 @@  static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 		}
 
 		if (btrfs_is_leaf(next))
-			status = btrfs_check_leaf(gfs_info, NULL, next);
+			status = btrfs_check_leaf(NULL, next);
 		else
-			status = btrfs_check_node(gfs_info, NULL, next);
+			status = btrfs_check_node(NULL, next);
 		if (status != BTRFS_TREE_BLOCK_CLEAN) {
 			free_extent_buffer(next);
 			err = -EIO;
@@ -3702,9 +3702,9 @@  static int check_fs_root(struct btrfs_root *root,
 
 	/* We may not have checked the root block, lets do that now */
 	if (btrfs_is_leaf(root->node))
-		status = btrfs_check_leaf(gfs_info, NULL, root->node);
+		status = btrfs_check_leaf(NULL, root->node);
 	else
-		status = btrfs_check_node(gfs_info, NULL, root->node);
+		status = btrfs_check_node(NULL, root->node);
 	if (status != BTRFS_TREE_BLOCK_CLEAN)
 		return -EIO;
 
@@ -4608,9 +4608,9 @@  static int check_block(struct btrfs_root *root,
 	rec->info_level = level;
 
 	if (btrfs_is_leaf(buf))
-		status = btrfs_check_leaf(gfs_info, &rec->parent_key, buf);
+		status = btrfs_check_leaf(&rec->parent_key, buf);
 	else
-		status = btrfs_check_node(gfs_info, &rec->parent_key, buf);
+		status = btrfs_check_node(&rec->parent_key, buf);
 
 	if (status != BTRFS_TREE_BLOCK_CLEAN) {
 		if (opt_check_repair)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index f0e5f8d6..1672da26 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -2695,7 +2695,7 @@  static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path)
 		 * we need to bail otherwise we could end up stuck.
 		 */
 		if (path->slots[0] == 0 &&
-		    btrfs_check_leaf(gfs_info, NULL, path->nodes[0]))
+		    btrfs_check_leaf(NULL, path->nodes[0]))
 			ret = -EIO;
 
 		if (ret < 0) {
@@ -5001,7 +5001,7 @@  static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 		if (*level == 0) {
 			/* skip duplicate check */
 			if (check || !check_all) {
-				ret = btrfs_check_leaf(gfs_info, NULL, cur);
+				ret = btrfs_check_leaf(NULL, cur);
 				if (ret != BTRFS_TREE_BLOCK_CLEAN) {
 					err |= -EIO;
 					break;
@@ -5018,7 +5018,7 @@  static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 			break;
 		}
 		if (check || !check_all) {
-			ret = btrfs_check_node(gfs_info, NULL, cur);
+			ret = btrfs_check_node(NULL, cur);
 			if (ret != BTRFS_TREE_BLOCK_CLEAN) {
 				err |= -EIO;
 				break;
@@ -5066,9 +5066,9 @@  static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 			break;
 
 		if (btrfs_is_leaf(next))
-			status = btrfs_check_leaf(gfs_info, NULL, next);
+			status = btrfs_check_leaf(NULL, next);
 		else
-			status = btrfs_check_node(gfs_info, NULL, next);
+			status = btrfs_check_node(NULL, next);
 		if (status != BTRFS_TREE_BLOCK_CLEAN) {
 			free_extent_buffer(next);
 			err |= -EIO;
diff --git a/kernel-shared/ctree.c b/kernel-shared/ctree.c
index 7d1b1316..fb56a863 100644
--- a/kernel-shared/ctree.c
+++ b/kernel-shared/ctree.c
@@ -612,9 +612,9 @@  static void generic_err(const struct extent_buffer *buf, int slot,
 }
 
 enum btrfs_tree_block_status
-btrfs_check_node(struct btrfs_fs_info *fs_info,
-		 struct btrfs_key *parent_key, struct extent_buffer *node)
+btrfs_check_node(struct btrfs_key *parent_key, struct extent_buffer *node)
 {
+	struct btrfs_fs_info *fs_info = node->fs_info;
 	unsigned long nr = btrfs_header_nritems(node);
 	struct btrfs_key key, next_key;
 	int slot;
@@ -683,9 +683,9 @@  fail:
 }
 
 enum btrfs_tree_block_status
-btrfs_check_leaf(struct btrfs_fs_info *fs_info,
-		 struct btrfs_key *parent_key, struct extent_buffer *leaf)
+btrfs_check_leaf(struct btrfs_key *parent_key, struct extent_buffer *leaf)
 {
+	struct btrfs_fs_info *fs_info = leaf->fs_info;
 	/* No valid key type is 0, so all key should be larger than this key */
 	struct btrfs_key prev_key = {0, 0, 0};
 	struct btrfs_key key;
@@ -811,9 +811,9 @@  static int noinline check_block(struct btrfs_fs_info *fs_info,
 		parent_key_ptr = &key;
 	}
 	if (level == 0)
-		ret = btrfs_check_leaf(fs_info, parent_key_ptr, path->nodes[0]);
+		ret = btrfs_check_leaf(parent_key_ptr, path->nodes[0]);
 	else
-		ret = btrfs_check_node(fs_info, parent_key_ptr, path->nodes[level]);
+		ret = btrfs_check_node(parent_key_ptr, path->nodes[level]);
 	if (ret == BTRFS_TREE_BLOCK_CLEAN)
 		return 0;
 	return -EIO;
diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index df7526d4..13264387 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -2705,11 +2705,9 @@  int btrfs_comp_cpu_keys(const struct btrfs_key *k1, const struct btrfs_key *k2);
 int btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path,
 		int level, int slot);
 enum btrfs_tree_block_status
-btrfs_check_node(struct btrfs_fs_info *fs_info,
-		 struct btrfs_key *parent_key, struct extent_buffer *buf);
+btrfs_check_node(struct btrfs_key *parent_key, struct extent_buffer *buf);
 enum btrfs_tree_block_status
-btrfs_check_leaf(struct btrfs_fs_info *fs_info,
-		 struct btrfs_key *parent_key, struct extent_buffer *buf);
+btrfs_check_leaf(struct btrfs_key *parent_key, struct extent_buffer *buf);
 void reada_for_search(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
 		      int level, int slot, u64 objectid);
 struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info,
diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c
index 3d2574d9..b5ad89c2 100644
--- a/kernel-shared/disk-io.c
+++ b/kernel-shared/disk-io.c
@@ -389,9 +389,9 @@  struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
 			 * btrfs ins dump-tree.
 			 */
 			if (btrfs_header_level(eb))
-				ret = btrfs_check_node(fs_info, NULL, eb);
+				ret = btrfs_check_node(NULL, eb);
 			else
-				ret = btrfs_check_leaf(fs_info, NULL, eb);
+				ret = btrfs_check_leaf(NULL, eb);
 			if (!ret || candidate_mirror == mirror_num) {
 				btrfs_set_buffer_uptodate(eb);
 				return eb;