Thread (42 messages) 42 messages, 5 authors, 2021-11-09

Re: [PATCH 06/20] btrfs-progs: check: stop passing csum root around

From: Qu Wenruo <hidden>
Date: 2021-11-06 00:21:19


On 2021/11/6 04:28, Josef Bacik wrote:
We pass the csum root from way high in the call chain in check down to
where we actually need it.  However we can just get it from the fs_info
in these places, so clean up the functions to skip passing around the
csum root needlessly.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Qu Wenruo <redacted>

Thanks,
Qu
quoted hunk ↗ jump to hunk
---
  check/main.c | 22 +++++++++-------------
  1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/check/main.c b/check/main.c
index 08810c5f..22306cf4 100644
--- a/check/main.c
+++ b/check/main.c
@@ -9494,9 +9494,9 @@ static int populate_csum(struct btrfs_trans_handle *trans,
  }

  static int fill_csum_tree_from_one_fs_root(struct btrfs_trans_handle *trans,
-				      struct btrfs_root *csum_root,
-				      struct btrfs_root *cur_root)
+					   struct btrfs_root *cur_root)
  {
+	struct btrfs_root *csum_root = gfs_info->csum_root;
  	struct btrfs_path path;
  	struct btrfs_key key;
  	struct extent_buffer *node;
@@ -9557,8 +9557,7 @@ out:
  	return ret;
  }

-static int fill_csum_tree_from_fs(struct btrfs_trans_handle *trans,
-				  struct btrfs_root *csum_root)
+static int fill_csum_tree_from_fs(struct btrfs_trans_handle *trans)
  {
  	struct btrfs_path path;
  	struct btrfs_root *tree_root = gfs_info->tree_root;
@@ -9598,8 +9597,7 @@ static int fill_csum_tree_from_fs(struct btrfs_trans_handle *trans,
  				key.objectid);
  			goto out;
  		}
-		ret = fill_csum_tree_from_one_fs_root(trans, csum_root,
-				cur_root);
+		ret = fill_csum_tree_from_one_fs_root(trans, cur_root);
  		if (ret < 0)
  			goto out;
  next:
@@ -9617,10 +9615,10 @@ out:
  	return ret;
  }

-static int fill_csum_tree_from_extent(struct btrfs_trans_handle *trans,
-				      struct btrfs_root *csum_root)
+static int fill_csum_tree_from_extent(struct btrfs_trans_handle *trans)
  {
  	struct btrfs_root *extent_root = gfs_info->extent_root;
+	struct btrfs_root *csum_root = gfs_info->csum_root;
  	struct btrfs_path path;
  	struct btrfs_extent_item *ei;
  	struct extent_buffer *leaf;
@@ -9690,13 +9688,12 @@ static int fill_csum_tree_from_extent(struct btrfs_trans_handle *trans,
   * will use fs/subvol trees to init the csum tree.
   */
  static int fill_csum_tree(struct btrfs_trans_handle *trans,
-			  struct btrfs_root *csum_root,
  			  int search_fs_tree)
  {
  	if (search_fs_tree)
-		return fill_csum_tree_from_fs(trans, csum_root);
+		return fill_csum_tree_from_fs(trans);
  	else
-		return fill_csum_tree_from_extent(trans, csum_root);
+		return fill_csum_tree_from_extent(trans);
  }

  static void free_roots_info_cache(void)
@@ -10700,8 +10697,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
  				goto close_out;
  			}

-			ret = fill_csum_tree(trans, gfs_info->csum_root,
-					     init_extent_tree);
+			ret = fill_csum_tree(trans, init_extent_tree);
  			err |= !!ret;
  			if (ret) {
  				error("checksum tree refilling failed: %d", ret);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help