From patchwork Tue Nov 24 05:16:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 7687611 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 C8CED9F4F5 for ; Tue, 24 Nov 2015 05:19:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12D9120862 for ; Tue, 24 Nov 2015 05:19:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4800207C9 for ; Tue, 24 Nov 2015 05:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752382AbbKXFTG (ORCPT ); Tue, 24 Nov 2015 00:19:06 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:8141 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750836AbbKXFTF (ORCPT ); Tue, 24 Nov 2015 00:19:05 -0500 X-IronPort-AV: E=Sophos;i="5.20,242,1444665600"; d="scan'208";a="774020" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by heian.cn.fujitsu.com with ESMTP; 24 Nov 2015 13:18:51 +0800 Received: from localhost.localdomain (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id tAO5IEsE029695; Tue, 24 Nov 2015 13:18:15 +0800 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: calestyo@scientia.net Subject: [PATCH] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag Date: Tue, 24 Nov 2015 13:16:51 +0800 Message-Id: <1448342211-21558-1-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.6.2 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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 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 --- cmds-check.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmds-check.c b/cmds-check.c index fd661d9..c235702 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);