From patchwork Fri Oct 25 09:30:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 3094671 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 C3DAEBF924 for ; Fri, 25 Oct 2013 09:30:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43F7C204D6 for ; Fri, 25 Oct 2013 09:30:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36F00200E3 for ; Fri, 25 Oct 2013 09:30:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752817Ab3JYJ37 (ORCPT ); Fri, 25 Oct 2013 05:29:59 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:48002 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752355Ab3JYJ36 (ORCPT ); Fri, 25 Oct 2013 05:29:58 -0400 X-IronPort-AV: E=Sophos;i="4.93,568,1378828800"; d="scan'208";a="8859037" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 25 Oct 2013 17:26:36 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r9P9TsHv011791 for ; Fri, 25 Oct 2013 17:29:54 +0800 Received: from miao.fnst.cn.fujitsu.com ([10.167.226.106]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013102517272123-2534124 ; Fri, 25 Oct 2013 17:27:21 +0800 From: Miao Xie To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs-progs: don't output baffling message when checking a fresh fs Date: Fri, 25 Oct 2013 17:30:45 +0800 Message-Id: <1382693445-16800-1-git-send-email-miaox@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/10/25 17:27:21, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/10/25 17:27:21, Serialize complete at 2013/10/25 17:27:21 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.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 As we know, a new fs doesn't have space cache, so we set the cache generation of the super block to be -1ULL, it is not equal to the fs generation. But the check program didn't consider this case, and output the following message cache and super generation don't match, space cache will be invalidated directly, it would be baffling the users. So we should avoid outputing such message. This patch fixes this problem. Signed-off-by: Miao Xie --- cmds-check.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmds-check.c b/cmds-check.c index 8015288..918e577 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -3210,7 +3210,8 @@ static int check_space_cache(struct btrfs_root *root) int ret; int error = 0; - if (btrfs_super_generation(root->fs_info->super_copy) != + if (btrfs_super_cache_generation(root->fs_info->super_copy) != -1ULL && + btrfs_super_generation(root->fs_info->super_copy) != btrfs_super_cache_generation(root->fs_info->super_copy)) { printf("cache and super generation don't match, space cache " "will be invalidated\n");