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

2012-09-21 Thread David Sterba
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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2012-09-20 Thread Anand jain
From: Anand Jain 

Signed-off-by: Anand Jain 
---
 debug-tree.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

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 ] 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();
-- 
1.7.1

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