From patchwork Wed Jun 18 05:28:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Hecheng X-Patchwork-Id: 4373201 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 05B9DBEEAA for ; Wed, 18 Jun 2014 05:33:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B416202FE for ; Wed, 18 Jun 2014 05:33:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69ED2202F2 for ; Wed, 18 Jun 2014 05:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756390AbaFRFdk (ORCPT ); Wed, 18 Jun 2014 01:33:40 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:55036 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753982AbaFRFdj (ORCPT ); Wed, 18 Jun 2014 01:33:39 -0400 X-IronPort-AV: E=Sophos;i="5.00,730,1396972800"; d="scan'208";a="32071250" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 18 Jun 2014 13:30:58 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s5I5XaXO028408 for ; Wed, 18 Jun 2014 13:33:36 +0800 Received: from localhost.localdomain (10.167.226.111) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Wed, 18 Jun 2014 13:33:47 +0800 From: Gui Hecheng To: CC: Gui Hecheng Subject: [PATCH] btrfs-progs: clean fsck noise for free inode generation 0 Date: Wed, 18 Jun 2014 13:28:22 +0800 Message-ID: <1403069302-12057-1-git-send-email-guihc.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 X-Originating-IP: [10.167.226.111] 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.9 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 When we write a btrfs to full and then we have no space left for free space cache. The btrfs check will output msg as follows which is noise indeed: # free space inode generation (0) did not match free space cache generation (XXX) When the free space cache is not written out normally, the free inode generation will be 0. In this condition, no noise should be outputed. Also, check 0-sized inode eariler together with 0-generationed inode. Signed-off-by: Gui Hecheng --- free-space-cache.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/free-space-cache.c b/free-space-cache.c index bddde24..2440dd8 100644 --- a/free-space-cache.c +++ b/free-space-cache.c @@ -310,6 +310,13 @@ static int __load_free_space_cache(struct btrfs_root *root, leaf = path->nodes[0]; inode_item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_inode_item); + + inode_size = btrfs_inode_size(leaf, inode_item); + if (!inode_size || !btrfs_inode_generation(leaf, inode_item)) { + btrfs_release_path(path); + return 0; + } + if (btrfs_inode_generation(leaf, inode_item) != generation) { printf("free space inode generation (%llu) did not match " "free space cache generation (%llu)\n", @@ -320,10 +327,7 @@ static int __load_free_space_cache(struct btrfs_root *root, return 0; } - inode_size = btrfs_inode_size(leaf, inode_item); btrfs_release_path(path); - if (inode_size == 0) - return 0; if (!num_entries) return 0;