diff mbox series

btrfs: print-tree: add generation and type dump for EXTENT_DATA_KEY

Message ID 0ff7d2afbab9518e677a725935c3f4e3224a4229.1719205115.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: print-tree: add generation and type dump for EXTENT_DATA_KEY | expand

Commit Message

Qu Wenruo June 24, 2024, 4:58 a.m. UTC
When debugging the recent ram_bytes mismatch bug, I can hit it with
enhanced tree-checker for file extent items at write time.

But the bug is not that easy to trigger (mostly triggered with
btrfs/06*, which uses 20 threads fsstress), and when I hit it, the only
info is the kernel leaf dump, but it doesn't include things like the
file extent type (REGULAR or PREALLOC).

Add the dump for generation and type (although only numeric output) to
make debugging a little easier.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/print-tree.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

David Sterba June 24, 2024, 5 p.m. UTC | #1
On Mon, Jun 24, 2024 at 02:28:54PM +0930, Qu Wenruo wrote:
> When debugging the recent ram_bytes mismatch bug, I can hit it with
> enhanced tree-checker for file extent items at write time.
> 
> But the bug is not that easy to trigger (mostly triggered with
> btrfs/06*, which uses 20 threads fsstress), and when I hit it, the only
> info is the kernel leaf dump, but it doesn't include things like the
> file extent type (REGULAR or PREALLOC).
> 
> Add the dump for generation and type (although only numeric output) to
> make debugging a little easier.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>
diff mbox series

Patch

diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index 7e46aa8a0444..bb2d497b421c 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -310,6 +310,9 @@  void btrfs_print_leaf(const struct extent_buffer *l)
 		case BTRFS_EXTENT_DATA_KEY:
 			fi = btrfs_item_ptr(l, i,
 					    struct btrfs_file_extent_item);
+			pr_info("\t\tgeneration %llu type %hhu\n",
+				btrfs_file_extent_generation(l, fi),
+				btrfs_file_extent_type(l, fi));
 			if (btrfs_file_extent_type(l, fi) ==
 			    BTRFS_FILE_EXTENT_INLINE) {
 				pr_info("\t\tinline extent data size %llu\n",