From patchwork Fri Aug 25 15:11:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9922305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7729A602BD for ; Fri, 25 Aug 2017 15:11:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69E65283BF for ; Fri, 25 Aug 2017 15:11:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D966283C7; Fri, 25 Aug 2017 15:11:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEA28283C5 for ; Fri, 25 Aug 2017 15:11:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933564AbdHYPLt (ORCPT ); Fri, 25 Aug 2017 11:11:49 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:35238 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932414AbdHYPLt (ORCPT ); Fri, 25 Aug 2017 11:11:49 -0400 Received: by mail-qt0-f194.google.com with SMTP id u11so84397qtu.2 for ; Fri, 25 Aug 2017 08:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=YwBahRPf8OYPKvvbq7mDkGgOjDsX2BECyCKzRgEyOms=; b=zMVzlVLOq8O1E5+NvUjC8Z7vFEdm8DF8H1i/Da0OnXWvXUO9E0IQlEHTQMnUC+x9u5 3dXQed8moaxXfXUjP4I+Kqs1W1bkAI+FNSuWGJb21VCuYaBj5YSVOOP+PcBueh0ATLr5 mnZ9qDgRfMV9vH8ZUdP/+QTw7KUCkXdyqfW2YVC3Tq7upKHDIEFVlgJl/uLlZ46APm5k /2yfUBVo10jKKDxOXQTreXAhdBeqPDaSAtAKvHyWqROYyWQGadbCXH/b01FmeP79yMR9 KQU7UzYj26jX+r645FFJgAdrB9Tn9l8kfO9CVJr4kQDrRDYtQEWwpxLRWQikUgO8q/Pv kJ9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YwBahRPf8OYPKvvbq7mDkGgOjDsX2BECyCKzRgEyOms=; b=VqOTmZcllE2cfPTNUN0QrSaQycaCIZbqyBX35CMFLaUjJRtprMqZ37CJAKIZazYgw8 JmdgmKMwsgeE9B6rslm1d6J1FwWhXnJYgTwETUUyLfstwkvVNrFWrfZmgteNQBn6bI1U hzSsvL2oF+kWGA3VUB7w2TqezAZvV+xYqPoqO5Q8EMqjVAcA6W461IjufXO9MtClhJ/k S4ynwp5US73G5dRDx49PN7zY4jBGDNrl4+IjgNQdihPySgPcvL+/v2tHxJSaxYwQszLm VSk0w3VAnTppePpKsqSntDPA6grdPtLMhasNA3lb3rPUfMQaXt62bkTY7Yj98HzJB/xB pMrg== X-Gm-Message-State: AHYfb5iWT3FAuXm7b5CeuUhIZqrPPawtwMKPHwz8qXTr9ZCqJzL2haps S8T1Hb6V/WoNqVyW0E0JQA== X-Received: by 10.200.42.176 with SMTP id b45mr14675237qta.76.1503673908297; Fri, 25 Aug 2017 08:11:48 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id m62sm4125644qkc.2.2017.08.25.08.11.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Aug 2017 08:11:47 -0700 (PDT) From: josef@toxicpanda.com X-Google-Original-From: jbacik@fb.com To: linux-btrfs@vger.kernel.org, kernel-team@fb.com Cc: Josef Bacik Subject: [PATCH][v2] btrfs-progs: print the csum length in debug-tree Date: Fri, 25 Aug 2017 11:11:46 -0400 Message-Id: <1503673906-14342-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Bacik 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 Reviewed-by: Nikolay Borisov --- 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;