diff mbox

[1/2] Btrfs-progs: fix the btrfs-debug-tree usage

Message ID 1348210784-29681-1-git-send-email-Anand.Jain@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anand Jain Sept. 21, 2012, 6:59 a.m. UTC
From: Anand Jain <anand.jain@oracle.com>

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 debug-tree.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

David Sterba Sept. 21, 2012, 3:14 p.m. UTC | #1
On Fri, Sep 21, 2012 at 02:59:44PM +0800, Anand jain wrote:
> @@ -51,6 +51,8 @@ static void print_extents(struct btrfs_root *root, struct extent_buffer *eb)
>  					     btrfs_node_blockptr(eb, i),
>  					     size,
>  					     btrfs_node_ptr_generation(eb, i));
> +		if(!next)
> +			BUG();

Is there a better way how to get out of this? btrfs-debug-tree is aimed
to help debugging, I don't want to see it crashed if there's some
inconsistency found, rather report it, that's a valuable information.

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/debug-tree.c b/debug-tree.c
index 94ffd8e..0e391fc 100644
--- a/debug-tree.c
+++ b/debug-tree.c
@@ -30,7 +30,7 @@ 
 
 static int print_usage(void)
 {
-	fprintf(stderr, "usage: debug-tree [ -e ] device\n");
+	fprintf(stderr, "usage: debug-tree [-derR] [-b <num>] device\n");
 	fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
 	exit(1);
 }
@@ -51,6 +51,8 @@  static void print_extents(struct btrfs_root *root, struct extent_buffer *eb)
 					     btrfs_node_blockptr(eb, i),
 					     size,
 					     btrfs_node_ptr_generation(eb, i));
+		if(!next)
+			BUG();
 		if (btrfs_is_leaf(next) &&
 		    btrfs_header_level(eb) != 1)
 			BUG();