From patchwork Mon Dec 22 02:53:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 5525661 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 ACCC4BEEA8 for ; Mon, 22 Dec 2014 02:55:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D74D320165 for ; Mon, 22 Dec 2014 02:55:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C70620107 for ; Mon, 22 Dec 2014 02:55:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753799AbaLVCzj (ORCPT ); Sun, 21 Dec 2014 21:55:39 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:47262 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753731AbaLVCzi (ORCPT ); Sun, 21 Dec 2014 21:55:38 -0500 X-IronPort-AV: E=Sophos;i="5.04,848,1406563200"; d="scan'208";a="45589007" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 22 Dec 2014 10:52:14 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id sBM2t86h009045; Mon, 22 Dec 2014 10:55:08 +0800 Received: from localhost.localdomain (10.167.226.33) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Mon, 22 Dec 2014 10:55:38 +0800 From: Qu Wenruo To: CC: Subject: [PATCH] btrfs-progs: Don't increase error count if the inode can be repaired. Date: Mon, 22 Dec 2014 10:53:36 +0800 Message-ID: <1419216816-13171-1-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.2.0 MIME-Version: 1.0 X-Originating-IP: [10.167.226.33] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 The original check_inode_recs() will return -1 if found any error in a inode_record. This is OK for original design since there is almost nothing can repair at that time. However more and more error from nlink mismatch to missing inode item can be repaired in try_repair_inode(), check_inode_recs() should not increase the error count if the inode can be repair. With this patch, repair function for leaf-corruption will not return error if all corruption inode can be recovered. Signed-off-by: Qu Wenruo Reviewed-by: Satoru Takeuchi --- cmds-check.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index 3e7a4eb..aa47984 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -2302,7 +2302,7 @@ static int check_inode_recs(struct btrfs_root *root, struct inode_record *rec; struct inode_backref *backref; int stage = 0; - int ret; + int ret = 0; int err = 0; u64 error = 0; u64 root_dirid = btrfs_root_dirid(&root->root_item); @@ -2452,7 +2452,8 @@ static int check_inode_recs(struct btrfs_root *root, ret = 0; } - error++; + if (!(repair && ret == 0)) + error++; print_inode_error(root, rec); list_for_each_entry(backref, &rec->backrefs, list) { if (!backref->found_dir_item)