From patchwork Wed Jul 18 07:09:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 171604 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 977392C0362 for ; Wed, 18 Jul 2012 17:20:45 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SrOVg-0004GL-E9; Wed, 18 Jul 2012 07:17:29 +0000 Received: from mail-lb0-f177.google.com ([209.85.217.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SrOTK-0003ss-C9; Wed, 18 Jul 2012 07:15:04 +0000 Received: by lbbgg6 with SMTP id gg6so1773066lbb.36 for ; Wed, 18 Jul 2012 00:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:reply-to:to:cc:date:in-reply-to:references :content-type:x-mailer:mime-version; bh=xnxRPYt4xwVhaKT6s6/Qq6f5LW/Nv8/87QMfdCrHMdM=; b=EzBNKsW10i3zizJSAQ3PksbpWPcgh1OCBI2n0FOQzXlRtaODwkCXC2nqlNEqcl9zKs kOTNd6fIvOM3iEXJ8LdprA9lwlaaYfswGu7klh3dN+naC7QMusYN3CkIi2iSoHGaS6Xv fRmmdRHAL2hK5FYz8+hVFOtPTMfRDigc3bW1bVNmx8lCEzuSIfZAto20URLjtfsdVtvd +c3aYQ5FH5rCJk1I2HCY3G4jqFEd+goUo8VQ5F+1trwJA8//ytHnLQaCm6GisVPF55NT oCmA6aqyJcGZQQFqln5UhJ/1nK1O06R2TuV2rcfTCIqo/TK1bHgL4rAvH5n02F8m0wqh x9Iw== Received: by 10.152.144.103 with SMTP id sl7mr2083853lab.37.1342595690150; Wed, 18 Jul 2012 00:14:50 -0700 (PDT) Received: from [10.106.12.134] (212-226-72-41-nat.elisa-mobile.fi. [212.226.72.41]) by mx.google.com with ESMTPS id gd9sm4553719lbb.15.2012.07.18.00.14.48 (version=SSLv3 cipher=OTHER); Wed, 18 Jul 2012 00:14:49 -0700 (PDT) Message-ID: <1342595359.31927.11.camel@brekeke> Subject: Re: [PATCH 1/5] ubi: introduce ubi->bad_peb_limit From: Artem Bityutskiy To: Shmulik Ladkani Date: Wed, 18 Jul 2012 10:09:19 +0300 In-Reply-To: <1341389164-24409-2-git-send-email-shmulik.ladkani@gmail.com> References: <1341389164-24409-1-git-send-email-shmulik.ladkani@gmail.com> <1341389164-24409-2-git-send-email-shmulik.ladkani@gmail.com> X-Mailer: Evolution 3.2.3 (3.2.3-3.fc16) Mime-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.4 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dedekind1[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.177 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (dedekind1[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FSL_FREEMAIL_2 FSL_FREEMAIL_2 0.0 FSL_FREEMAIL_1 FSL_FREEMAIL_1 Cc: Russell King , Richard Genoud , Richard Weinberger , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Andrew Victor , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: dedekind1@gmail.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On Wed, 2012-07-04 at 11:06 +0300, Shmulik Ladkani wrote: > Introduce 'ubi->bad_peb_limit', which specifies an upper limit of PEBs > ubi expects to go bad. > Currently, it is initialized to a fixed percentage of total PEBs in the > ubi device (configurable via CONFIG_MTD_UBI_BEB_LIMIT). > > The 'bad_peb_limit' is intended to be used for calculating the amount of > PEBs ubi needs to reserve for bad eraseblock handling. > > Signed-off-by: Shmulik Ladkani Created branch "beb" and pushed this patch there with minor amendments (see diff below). Let's use this branch in UBI tree for this work and merge it as soon as it is ready. diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index c33e25b..dee90b7 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -668,13 +668,12 @@ static int io_init(struct ubi_device *ubi) ubi->bad_allowed = 1; if (CONFIG_MTD_UBI_BEB_LIMIT > 0) { int percent = CONFIG_MTD_UBI_BEB_LIMIT; - int beb_limit; + int limit = mult_frac(ubi->peb_count, percent, 100); - beb_limit = mult_frac(ubi->peb_count, percent, 100); - /* round it up */ - if (mult_frac(beb_limit, 100, percent) < ubi->peb_count) - beb_limit++; - ubi->bad_peb_limit = beb_limit; + /* Round it up */ + if (mult_frac(limit, 100, percent) < ubi->peb_count) + limit += 1; + ubi->bad_peb_limit = limit; } }