From patchwork Wed Feb 28 10:13:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lu Fengqi X-Patchwork-Id: 10247091 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 773FC60362 for ; Wed, 28 Feb 2018 10:13:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E45228BCD for ; Wed, 28 Feb 2018 10:13:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F61928C5A; Wed, 28 Feb 2018 10:13:36 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 B83BC28BCD for ; Wed, 28 Feb 2018 10:13:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752173AbeB1KNc (ORCPT ); Wed, 28 Feb 2018 05:13:32 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:63371 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752085AbeB1KNc (ORCPT ); Wed, 28 Feb 2018 05:13:32 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="37331116" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 28 Feb 2018 18:13:31 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id A912748AE762 for ; Wed, 28 Feb 2018 18:13:30 +0800 (CST) Received: from fnst.lan (10.167.226.155) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 28 Feb 2018 18:13:34 +0800 From: Lu Fengqi To: Subject: [PATCH v2 1/3] btrfs-progs: check/lowmem: Fix the incorrect error message of check_extent_data_item Date: Wed, 28 Feb 2018 18:13:21 +0800 Message-ID: <20180228101323.25442-1-lufq.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 X-Originating-IP: [10.167.226.155] X-yoursite-MailScanner-ID: A912748AE762.A98E7 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lufq.fnst@cn.fujitsu.com 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 Instead of the disk_bytenr and disk_num_bytes of the extent_item which the file extent references, we should output the objectid and offset of the file extent. And the leaf may be shared by the file trees, we should print the objectid of the root and the owner of the leaf. Fixes: b0d360b541f0 ("btrfs-progs: check: introduce function to check data backref in extent tree") Signed-off-by: Lu Fengqi Signed-off-by: Lu Fengqi Reviewed-by: Qu Wenruo Reviewed-by: Qu Wenruo --- V2: Output the objectid of the root and the owner of the leaf. check/mode-lowmem.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 62bcf3d2e126..f37b1b2c1571 100644 --- a/check/mode-lowmem.c +++ b/check/mode-lowmem.c @@ -2631,9 +2631,9 @@ static int check_extent_data_item(struct btrfs_root *root, if (!(extent_flags & BTRFS_EXTENT_FLAG_DATA)) { error( - "extent[%llu %llu] backref type mismatch, wanted bit: %llx", - disk_bytenr, disk_num_bytes, - BTRFS_EXTENT_FLAG_DATA); +"file extent[%llu %llu] root %llu owner %llu backref type mismatch, wanted bit: %llx", + fi_key.objectid, fi_key.offset, root->objectid, owner, + BTRFS_EXTENT_FLAG_DATA); err |= BACKREF_MISMATCH; } @@ -2722,8 +2722,9 @@ out: err |= BACKREF_MISSING; btrfs_release_path(&path); if (err & BACKREF_MISSING) { - error("data extent[%llu %llu] backref lost", - disk_bytenr, disk_num_bytes); + error( + "file extent[%llu %llu] root %llu owner %llu backref lost", + fi_key.objectid, fi_key.offset, root->objectid, owner); } return err; }