All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: print bytenr of child eb if mismatched level found in read_node_slot()
@ 2021-01-06 10:35 Su Yue
  2021-01-06 11:36 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Su Yue @ 2021-01-06 10:35 UTC (permalink / raw)
  To: linux-btrfs; +Cc: l

If btrfs check reported like "ERROR: child eb corrupted: parent bytenr
=178081 item=246 parent level=1 child level=2". It's hard to find
which eb is corrupted without bytenr in dump tree information:
===================================================================
node 178081 level 1 items 424 free 69 generation 44495 owner EXTENT_TREE
fs uuid 7d9dbe1b-dea6-4141-807b-026325123ad8
chunk uuid 97a3e3aa-7105-4101-aaf7-50204a240e69
        key (16613126144 EXTENT_ITEM 4096) block 177939087360 gen 44433
        key (16632803328 EXTENT_ITEM 4096) block 177939120128 gen 44433
        key (16654548992 EXTENT_ITEM 8192) block 177970380800 gen 44336
        key (16697884672 EXTENT_ITEM 8192) block 177970397184 gen 44336
        key (16714223616 EXTENT_ITEM 16384) block 177970413568 gen 44336
        key (16721760256 EXTENT_ITEM 16384) block 177943855104 gen 44436
        key (16857755648 EXTENT_ITEM 4096) block 177857544192 gen 44416
...

===================================================================

For easier lookup, print bytenr of child eb if its level is not equal
to parent's level - 1 in read_node_slot().

Signed-off-by: Su Yue <l@damenly.su>
---
 kernel-shared/ctree.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel-shared/ctree.c b/kernel-shared/ctree.c
index 01bc33a43c33..4cc3aebc1412 100644
--- a/kernel-shared/ctree.c
+++ b/kernel-shared/ctree.c
@@ -809,9 +809,9 @@ struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info,
 
 	if (btrfs_header_level(ret) != level - 1) {
 		error(
-"child eb corrupted: parent bytenr=%llu item=%d parent level=%d child level=%d",
-		      btrfs_header_bytenr(parent), slot,
-		      btrfs_header_level(parent), btrfs_header_level(ret));
+"child eb corrupted: parent bytenr=%llu item=%d parent level=%d child bytenr=%llu child level=%d",
+		      btrfs_header_bytenr(parent), slot, btrfs_header_level(parent),
+		      btrfs_header_bytenr(ret), btrfs_header_level(ret));
 		free_extent_buffer(ret);
 		return ERR_PTR(-EIO);
 	}
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs-progs: print bytenr of child eb if mismatched level found in read_node_slot()
  2021-01-06 10:35 [PATCH] btrfs-progs: print bytenr of child eb if mismatched level found in read_node_slot() Su Yue
@ 2021-01-06 11:36 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2021-01-06 11:36 UTC (permalink / raw)
  To: Su Yue; +Cc: linux-btrfs

On Wed, Jan 06, 2021 at 06:35:50PM +0800, Su Yue wrote:
> If btrfs check reported like "ERROR: child eb corrupted: parent bytenr
> =178081 item=246 parent level=1 child level=2". It's hard to find
> which eb is corrupted without bytenr in dump tree information:
> ===================================================================
> node 178081 level 1 items 424 free 69 generation 44495 owner EXTENT_TREE
> fs uuid 7d9dbe1b-dea6-4141-807b-026325123ad8
> chunk uuid 97a3e3aa-7105-4101-aaf7-50204a240e69
>         key (16613126144 EXTENT_ITEM 4096) block 177939087360 gen 44433
>         key (16632803328 EXTENT_ITEM 4096) block 177939120128 gen 44433
>         key (16654548992 EXTENT_ITEM 8192) block 177970380800 gen 44336
>         key (16697884672 EXTENT_ITEM 8192) block 177970397184 gen 44336
>         key (16714223616 EXTENT_ITEM 16384) block 177970413568 gen 44336
>         key (16721760256 EXTENT_ITEM 16384) block 177943855104 gen 44436
>         key (16857755648 EXTENT_ITEM 4096) block 177857544192 gen 44416
> ...
> 
> ===================================================================
> 
> For easier lookup, print bytenr of child eb if its level is not equal
> to parent's level - 1 in read_node_slot().
> 
> Signed-off-by: Su Yue <l@damenly.su>

Added to devel, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-06 11:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 10:35 [PATCH] btrfs-progs: print bytenr of child eb if mismatched level found in read_node_slot() Su Yue
2021-01-06 11:36 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.