diff mbox series

btrfs-progs: dump-tree: skip tree-checker when dumpping tree blocks

Message ID a6b4198481004f1ddcdbac00f8559c787646557e.1684236530.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: dump-tree: skip tree-checker when dumpping tree blocks | expand

Commit Message

Qu Wenruo May 16, 2023, 11:28 a.m. UTC
Since commit c8593f65cbf3 ("btrfs-progs: sync tree-checker.[ch] from
kernel"), btrfs-progs can do the kernel level tree block checks, which
is not really sutiable for dump-tree.

Under a lot of cases, we're using dump-tree tool to debug to collect the
details from end users.
If it's a bitflip causing a rejection, we would be unable to determine
the cause.

So this patch would add OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS for dump-tree.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 cmds/inspect-dump-tree.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Anand Jain May 17, 2023, 3:58 a.m. UTC | #1
On 16/5/23 19:28, Qu Wenruo wrote:
> Since commit c8593f65cbf3 ("btrfs-progs: sync tree-checker.[ch] from
> kernel"), btrfs-progs can do the kernel level tree block checks, which
> is not really sutiable for dump-tree.
> 
> Under a lot of cases, we're using dump-tree tool to debug to collect the
> details from end users.
> If it's a bitflip causing a rejection, we would be unable to determine
> the cause.
> 

  Yep. Agreed.

> So this patch would add OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS for dump-tree.

  By default, it is a good idea to skip the tree checker for the
  dump-tree. Additionally, we may requires an option to dump the
  tree with the tree checker. However, I don't see any use case yet.

> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Anand Jain <anand.jain@oracle.com>

Thanks, Anand
> ---
>   cmds/inspect-dump-tree.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/cmds/inspect-dump-tree.c b/cmds/inspect-dump-tree.c
> index 7c524b04d6f7..bfc0fff148dd 100644
> --- a/cmds/inspect-dump-tree.c
> +++ b/cmds/inspect-dump-tree.c
> @@ -342,8 +342,12 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd,
>   	 * Use NO_BLOCK_GROUPS here could also speedup open_ctree() and allow us
>   	 * to inspect fs with corrupted extent tree blocks, and show as many good
>   	 * tree blocks as possible.
> +	 *
> +	 * And we want to avoid tree-checker, which can rejects the target tree
> +	 * block completely, while we may be debugging the problem.
>   	 */
> -	open_ctree_flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS;
> +	open_ctree_flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS |
> +			   OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS;
>   	cache_tree_init(&block_root);
>   	optind = 0;
>   	while (1) {
David Sterba May 22, 2023, 12:23 p.m. UTC | #2
On Wed, May 17, 2023 at 11:58:33AM +0800, Anand Jain wrote:
> On 16/5/23 19:28, Qu Wenruo wrote:
> > Since commit c8593f65cbf3 ("btrfs-progs: sync tree-checker.[ch] from
> > kernel"), btrfs-progs can do the kernel level tree block checks, which
> > is not really sutiable for dump-tree.
> > 
> > Under a lot of cases, we're using dump-tree tool to debug to collect the
> > details from end users.
> > If it's a bitflip causing a rejection, we would be unable to determine
> > the cause.
> > 
> 
>   Yep. Agreed.
> 
> > So this patch would add OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS for dump-tree.
> 
>   By default, it is a good idea to skip the tree checker for the
>   dump-tree. Additionally, we may requires an option to dump the
>   tree with the tree checker. However, I don't see any use case yet.

Yeah we can add an option to "fail on first error" if needed.
diff mbox series

Patch

diff --git a/cmds/inspect-dump-tree.c b/cmds/inspect-dump-tree.c
index 7c524b04d6f7..bfc0fff148dd 100644
--- a/cmds/inspect-dump-tree.c
+++ b/cmds/inspect-dump-tree.c
@@ -342,8 +342,12 @@  static int cmd_inspect_dump_tree(const struct cmd_struct *cmd,
 	 * Use NO_BLOCK_GROUPS here could also speedup open_ctree() and allow us
 	 * to inspect fs with corrupted extent tree blocks, and show as many good
 	 * tree blocks as possible.
+	 *
+	 * And we want to avoid tree-checker, which can rejects the target tree
+	 * block completely, while we may be debugging the problem.
 	 */
-	open_ctree_flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS;
+	open_ctree_flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS |
+			   OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS;
 	cache_tree_init(&block_root);
 	optind = 0;
 	while (1) {