From patchwork Wed Nov 30 12:13:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhavesh Parekh X-Patchwork-Id: 128491 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 64AE0B6F91 for ; Wed, 30 Nov 2011 23:15:26 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RVj2x-00019i-LG; Wed, 30 Nov 2011 12:13:55 +0000 Received: from hqemgate04.nvidia.com ([216.228.121.35]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RVj2t-00019I-W0 for linux-mtd@lists.infradead.org; Wed, 30 Nov 2011 12:13:52 +0000 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate04.nvidia.com id ; Wed, 30 Nov 2011 04:12:30 -0800 Received: from hqnvemgw02.nvidia.com ([172.17.108.22]) by hqnvupgp08.nvidia.com (PGP Universal service); Wed, 30 Nov 2011 04:13:49 -0800 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Wed, 30 Nov 2011 04:13:49 -0800 Received: from thelma.nvidia.com (Not Verified[172.16.212.77]) by hqnvemgw02.nvidia.com with MailMarshal (v6, 7, 2, 8378) id ; Wed, 30 Nov 2011 04:13:49 -0800 Received: from localhost.localdomain (dhcp-10-24-100-200.nvidia.com [10.24.100.200]) by thelma.nvidia.com (8.13.8+Sun/8.8.8) with ESMTP id pAUCDivQ024792; Wed, 30 Nov 2011 04:13:48 -0800 (PST) From: Bhavesh Parekh To: dedekind1@gmail.com Subject: [PATCH] [MTD:UBI] Missing scrub when there is a bit-flip Date: Wed, 30 Nov 2011 17:43:42 +0530 Message-Id: <1322655222-28348-2-git-send-email-bparekh@nvidia.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1322655222-28348-1-git-send-email-bparekh@nvidia.com> References: <1322655222-28348-1-git-send-email-bparekh@nvidia.com> X-NVConfidentiality: public X-Spam-Note: CRM114 invocation failed X-Spam-Score: -5.4 (-----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-5.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [216.228.121.35 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.2 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-mtd@lists.infradead.org, Bhavesh Parekh X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Under some cases, when scrubbing the PEB if we didnot get the lock on the PEB it fails to scrub. Add that PEB again to the scrub list Signed-off-by: Bhavesh Parekh --- drivers/mtd/ubi/eba.c | 2 +- drivers/mtd/ubi/ubi.h | 3 +++ drivers/mtd/ubi/wl.c | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index fb7f19b..fb808d6 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c @@ -1033,7 +1033,7 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, err = leb_write_trylock(ubi, vol_id, lnum); if (err) { dbg_wl("contention on LEB %d:%d, cancel", vol_id, lnum); - return MOVE_CANCEL_RACE; + return MOVE_RETRY; } /* diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index dc64c76..15aba00 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -120,6 +120,8 @@ enum { * PEB * MOVE_CANCEL_BITFLIPS: canceled because a bit-flip was detected in the * target PEB + * MOVE_RETRY: Retry scrubbing the given PEB, as we didnot got lock last-time on + * it */ enum { MOVE_CANCEL_RACE = 1, @@ -127,6 +129,7 @@ enum { MOVE_TARGET_RD_ERR, MOVE_TARGET_WR_ERR, MOVE_CANCEL_BITFLIPS, + MOVE_RETRY, }; /** diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 42c684c..277c429 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -795,7 +795,10 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, protect = 1; goto out_not_moved; } - + if (err == MOVE_RETRY) { + scrubbing = 1; + goto out_not_moved; + } if (err == MOVE_CANCEL_BITFLIPS || err == MOVE_TARGET_WR_ERR || err == MOVE_TARGET_RD_ERR) { /*