From patchwork Wed Nov 25 06:19:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 7695501 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 34E669F1BE for ; Wed, 25 Nov 2015 06:21:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 618C820859 for ; Wed, 25 Nov 2015 06:21:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B62020842 for ; Wed, 25 Nov 2015 06:21:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932367AbbKYGVS (ORCPT ); Wed, 25 Nov 2015 01:21:18 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:52324 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932343AbbKYGVS (ORCPT ); Wed, 25 Nov 2015 01:21:18 -0500 X-IronPort-AV: E=Sophos;i="5.20,242,1444665600"; d="scan'208";a="822802" Received: from unknown (HELO cn.fujitsu.com) ([10.167.250.3]) by heian.cn.fujitsu.com with ESMTP; 25 Nov 2015 14:21:05 +0800 Received: from localhost.localdomain (unknown [10.167.226.34]) by cn.fujitsu.com (Postfix) with ESMTP id 4AD6A4043CE0; Wed, 25 Nov 2015 14:21:08 +0800 (CST) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: calestyo@scientia.net Subject: [PATCH v2] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag Date: Wed, 25 Nov 2015 14:19:06 +0800 Message-Id: <1448432346-2842-1-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 X-yoursite-MailScanner-Information: Please contact the ISP for more information X-yoursite-MailScanner-ID: 4AD6A4043CE0.AD5B8 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@cn.fujitsu.com X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In process_extent_item(), it gives 'metadata' initial value 0, but for non-skinny-metadata case, metadata extent can't be judged just from key type and it forgot that case. This causes a lot of false alert in non-skinny-metadata filesystem. Fix it by set correct metadata value before calling add_extent_rec(). Reported-by: Christoph Anton Mitterer Signed-off-by: Qu Wenruo --- v2: Use bit AND instead of equal to check TREE_BLOCK bit. --- cmds-check.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmds-check.c b/cmds-check.c index fd661d9..938b863 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -5134,6 +5134,10 @@ static int process_extent_item(struct btrfs_root *root, ei = btrfs_item_ptr(eb, slot, struct btrfs_extent_item); refs = btrfs_extent_refs(eb, ei); + if (btrfs_extent_flags(eb, ei) & BTRFS_EXTENT_FLAG_TREE_BLOCK) + metadata = 1; + else + metadata = 0; add_extent_rec(extent_cache, NULL, 0, key.objectid, num_bytes, refs, 0, 0, 0, metadata, 1, num_bytes);