Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: print the csum length in debug-tree
@ 2017-08-25 13:13 josef
  2017-08-25 13:48 ` Nikolay Borisov
  0 siblings, 1 reply; 4+ messages in thread
From: josef @ 2017-08-25 13:13 UTC (permalink / raw)
  To: kernel-team, linux-btrfs; +Cc: Josef Bacik

From: Josef Bacik <jbacik@fb.com>

While looking at a log of a corrupted fs I needed to verify we were
missing csums for a given range.  Make this easier by printing out how
many bytes a csum extent item represents when using btrfs_debug_tree.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 print-tree.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/print-tree.c b/print-tree.c
index 5927ed3..a124c96 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -1103,9 +1103,15 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *eb)
 		case BTRFS_CSUM_ITEM_KEY:
 			printf("\t\tcsum item\n");
 			break;
-		case BTRFS_EXTENT_CSUM_KEY:
-			printf("\t\textent csum item\n");
+		case BTRFS_EXTENT_CSUM_KEY: {
+			u16 csum_size =
+				btrfs_super_csum_size(root->fs_info->super_copy);
+			u32 size = (item_size / csum_size) *
+				root->fs_info->sectorsize;
+			printf("\t\textent csum item bytes %lu\n",
+			       (unsigned long)size);
 			break;
+			}
 		case BTRFS_EXTENT_DATA_KEY:
 			print_file_extent_item(eb, item, i, ptr);
 			break;
-- 
2.7.4


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

end of thread, other threads:[~2017-09-01 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-25 13:13 [PATCH] btrfs-progs: print the csum length in debug-tree josef
2017-08-25 13:48 ` Nikolay Borisov
2017-08-25 14:06   ` Josef Bacik
2017-09-01 15:10   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox