From patchwork Mon Aug 24 15:34:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaolei X-Patchwork-Id: 7065251 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 58FE39F305 for ; Mon, 24 Aug 2015 15:37:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB6972040F for ; Mon, 24 Aug 2015 15:37:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E4E1520785 for ; Mon, 24 Aug 2015 15:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754829AbbHXPgF (ORCPT ); Mon, 24 Aug 2015 11:36:05 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:56496 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754738AbbHXPgD (ORCPT ); Mon, 24 Aug 2015 11:36:03 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="99961766" Received: from bogon (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 24 Aug 2015 23:39:10 +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 t7OFZrLo015995 for ; Mon, 24 Aug 2015 23:35:53 +0800 Received: from localhost.localdomain (10.167.226.114) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.181.6; Mon, 24 Aug 2015 23:35:58 +0800 From: Zhao Lei To: CC: Zhao Lei Subject: [PATCH 2/5] btrfs: Reset sblock->xxx_error stats before calling scrub_recheck_block_checksum Date: Mon, 24 Aug 2015 23:34:17 +0800 Message-ID: X-Mailer: git-send-email 1.8.5.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-8.3 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 We should reset sblock->xxx_error stats before calling scrub_recheck_block_checksum(). Current code run correctly because all sblock are allocated by k[cz]alloc(), and the error stats are not got changed. Signed-off-by: Zhao Lei --- fs/btrfs/scrub.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index c8c16f4..4326e16 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1508,6 +1508,7 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info, sblock->no_io_error_seen = 1; sblock->header_error = 0; sblock->checksum_error = 0; + sblock->generation_error = 0; for (page_num = 0; page_num < sblock->page_count; page_num++) { struct bio *bio; @@ -2216,6 +2217,9 @@ static void scrub_missing_raid56_worker(struct btrfs_work *work) logical = sblock->pagev[0]->logical; dev = sblock->pagev[0]->dev; + sblock->header_error = 0; + sblock->checksum_error = 0; + sblock->generation_error = 0; if (sblock->no_io_error_seen) { scrub_recheck_block_checksum(fs_info, sblock, is_metadata, have_csum, csum, generation,