From: Andrew Worsley <amworsley@gmail.com>
To: Artem Bityutskiy <dedekind1@gmail.com>,
Richard Weinberger <richard@nod.at>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Boris Brezillon <boris.brezillon@bootlin.com>,
Marek Vasut <marek.vasut@gmail.com>,
linux-mtd@lists.infradead.org (open list:UNSORTED BLOCK IMAGES
(UBI)), linux-kernel@vger.kernel.org (open list)
Cc: Andrew Worsley <amworsley@gmail.com>
Subject: [PATCH] Round UBI average erase count up to next integer
Date: Tue, 18 Sep 2018 23:05:21 +1000 [thread overview]
Message-ID: <20180918130521.22880-2-amworsley@gmail.com> (raw)
In-Reply-To: <20180918130521.22880-1-amworsley@gmail.com>
Use a slightly larger than average EC so these PEBs will be
reinitialised with erase counts that make them less likely to
be reused than other (perhaps less worn or error-prone) PEBs
We have more frequent ECC failures on reads of page 0 of some PEBs
which manifest itself commonly during ubiattach. We believe this is due to
"program disturb" and want those PEB to be re-used later than average.
Signed-off-by: Andrew Worsley <amworsley@gmail.com>
---
drivers/mtd/ubi/attach.c | 2 +-
drivers/mtd/ubi/fastmap.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index 93ceea4f27d5..f97e2ba56fb2 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -1414,7 +1414,7 @@ static int scan_all(struct ubi_device *ubi, struct ubi_attach_info *ai,
/* Calculate mean erase counter */
if (ai->ec_count)
- ai->mean_ec = div_u64(ai->ec_sum, ai->ec_count);
+ ai->mean_ec = div_u64(ai->ec_sum+ai->ec_count-1, ai->ec_count);
err = late_analysis(ubi, ai);
if (err)
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 462526a10537..91e513788f38 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -684,7 +684,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
be32_to_cpu(fmec->ec), 1);
}
- ai->mean_ec = div_u64(ai->ec_sum, ai->ec_count);
+ ai->mean_ec = div_u64(ai->ec_sum+ai->ec_count-1, ai->ec_count);
ai->bad_peb_count = be32_to_cpu(fmhdr->bad_peb_count);
/* Iterate over all volumes and read their EBA table */
--
2.11.0
next prev parent reply other threads:[~2018-09-18 13:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 13:05 Round up the average EC for recovered EB to defer their reuse Andrew Worsley
2018-09-18 13:05 ` Andrew Worsley [this message]
2018-09-18 14:31 ` [PATCH] Round UBI average erase count up to next integer Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180918130521.22880-2-amworsley@gmail.com \
--to=amworsley@gmail.com \
--cc=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).