All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][v2] btrfs-progs: print the csum length in debug-tree
@ 2017-08-25 15:11 josef
  2017-08-25 15:17 ` Nikolay Borisov
  0 siblings, 1 reply; 3+ messages in thread
From: josef @ 2017-08-25 15:11 UTC (permalink / raw)
  To: linux-btrfs, kernel-team; +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 the
range of bytes a csum item covers.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
v1->v2:
- print the byte range instead of just the length

 print-tree.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/print-tree.c b/print-tree.c
index 5927ed3..2aead6a 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -1103,9 +1103,16 @@ 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 range %llu-%llu\n",
+			       (unsigned long long)disk_key.offset,
+			       (unsigned long long)disk_key.offset + 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] 3+ messages in thread

* Re: [PATCH][v2] btrfs-progs: print the csum length in debug-tree
  2017-08-25 15:11 [PATCH][v2] btrfs-progs: print the csum length in debug-tree josef
@ 2017-08-25 15:17 ` Nikolay Borisov
  2017-09-01 15:29   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Borisov @ 2017-08-25 15:17 UTC (permalink / raw)
  To: josef, linux-btrfs, kernel-team; +Cc: Josef Bacik



On 25.08.2017 18:11, josef@toxicpanda.com wrote:
> 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 the
> range of bytes a csum item covers.
> 
> Signed-off-by: Josef Bacik <jbacik@fb.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> v1->v2:
> - print the byte range instead of just the length
> 
>  print-tree.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/print-tree.c b/print-tree.c
> index 5927ed3..2aead6a 100644
> --- a/print-tree.c
> +++ b/print-tree.c
> @@ -1103,9 +1103,16 @@ 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 range %llu-%llu\n",
> +			       (unsigned long long)disk_key.offset,
> +			       (unsigned long long)disk_key.offset + size);
>  			break;
> +			}
>  		case BTRFS_EXTENT_DATA_KEY:
>  			print_file_extent_item(eb, item, i, ptr);
>  			break;
> 

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

* Re: [PATCH][v2] btrfs-progs: print the csum length in debug-tree
  2017-08-25 15:17 ` Nikolay Borisov
@ 2017-09-01 15:29   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2017-09-01 15:29 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: josef, linux-btrfs, kernel-team, Josef Bacik

On Fri, Aug 25, 2017 at 06:17:23PM +0300, Nikolay Borisov wrote:
> 
> 
> On 25.08.2017 18:11, josef@toxicpanda.com wrote:
> > 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 the
> > range of bytes a csum item covers.
> > 
> > Signed-off-by: Josef Bacik <jbacik@fb.com>
> 
> Reviewed-by: Nikolay Borisov <nborisov@suse.com>

v2 applied, thanks.

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 15:11 [PATCH][v2] btrfs-progs: print the csum length in debug-tree josef
2017-08-25 15:17 ` Nikolay Borisov
2017-09-01 15:29   ` 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.