From: Angus CLARK <angus.clark@st.com>
To: linux-mtd@lists.infradead.org
Cc: dwmw2@infradead.org, Shmulik Ladkani <shmulik.ladkani@gmail.com>,
dedekind1@gmail.com
Subject: Re: mtd nand erase and bad block
Date: Wed, 27 Jun 2012 13:37:07 +0100 [thread overview]
Message-ID: <4FEAFE73.2040303@st.com> (raw)
In-Reply-To: <1340790846.29342.19.camel@sauron.fi.intel.com>
On 06/27/2012 10:54 AM, Artem Bityutskiy wrote:
> On Mon, 2012-06-18 at 10:34 +0100, Angus CLARK wrote:
>> On 06/05/2012 01:17 PM, Artem Bityutskiy wrote:
>>> On Fri, 2012-06-01 at 17:54 +0300, Shmulik Ladkani wrote:
>>>>
>>>> My personal preference would be:
>>>> 1. A new ioctl (MEMSCRUB?)
>>>> 2. debugfs flag, PER MTD PART (slightly safer than your global flag)
>>>> 3. global debugfs flag
>>>>
>>> Yes, I guess option 1 is the best I think. Option 2 needs too much work.
>>
>> Are you ok with the name MEMSCRUB? I know previously you have objected to this
>> name, since it might get confused with UBI scrubbing
>> (http://lists.infradead.org/pipermail/linux-mtd/2010-September/032031.html). In
>> fact, the conclusion of that thread was to add an extended erase IOCTL, with a
>> 'flags' parameter to capture options such as erase bad blocks. Would this be
>> the preferred method (it didn't seem to go anywhere last time), or is 'MEMSCRUB'
>> with the existing erase_info_user64 structure acceptable?
>
> I think Shmulik had a good point - scrubbing is not only about erasing,
> but also about changing the BBT. So a separate ioctl makes more sense.
> As for the name, we could name it MEMBBSCRUB, I guess?
>
There may be others, but the two use-cases I have for erasing blocks marked as
bad are:
1. Restore the status of a block known to be good, but marked as bad. The block
may have been marked bad deliberately, for test purposes, or it may have been
incorrectly identified as bad due to "alien" data from a previous driver/ECC
scheme clashing with the OOB BBM.
2. Erase the Flash-resident BBTs. These blocks are reported as bad to prevent
accidental write or erase operations. However, one might want to erase the
BBTs, either to test the OOB BBM scanning and BBT rebuild on next reboot, or
prior to changing driver and/or ECC scheme.
For case 1, it makes sense to update the BBTs at the same time. At present, I
have to scrub the block in question, scrub the BBTs, and then reboot to force a
rescan/rebuild of the BBTs. (This is fairly simple to do, but does risk loosing
information about blocks that have gone bad through wear, unless invoking the
"mtd: nand: write BBM to OOB even with flash-based BBT" patch.)
However, for case 2, I just want to force the erase operation so I can wipe the
BBTs and return the device as close as possible to its original state. We could
put some logic in the kernel, "if 'MEMBBSCRUB" on BBT blocks, do not
update/rewrite BBTs", but I think this "policy" decision would be better handled
in userspace.
At the risk of repeating the discussion in
http://lists.infradead.org/pipermail/linux-mtd/2010-September/032031.html, how
about adding the MEMSCRUB IOCTL for erasing blocks marked as bad (I have the
kernel and mtd-utils patches available), and then adding 'MEMSETGOODBLOCK' for
updating the BBTs and/or OOB BBM?
Cheers,
Angus
next prev parent reply other threads:[~2012-06-27 12:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-31 12:12 mtd nand erase and bad block Matteo Facchinetti
2012-05-31 13:28 ` Adrian Hunter
2012-05-31 14:28 ` Matteo Facchinetti
2012-05-31 19:57 ` Shmulik Ladkani
2012-06-01 6:24 ` Adrian Hunter
2012-06-01 6:37 ` Ricard Wanderlof
2012-06-01 8:29 ` Angus CLARK
2012-06-01 8:42 ` Artem Bityutskiy
2012-06-01 11:04 ` Shmulik Ladkani
2012-06-01 14:03 ` Angus CLARK
2012-06-01 14:54 ` Shmulik Ladkani
2012-06-01 15:28 ` Angus CLARK
2012-06-05 12:17 ` Artem Bityutskiy
2012-06-14 17:48 ` Brian Norris
2012-06-14 21:31 ` Shmulik Ladkani
2012-06-15 6:55 ` Angus CLARK
2012-06-26 22:10 ` Tomer Barletz
2012-06-18 9:34 ` Angus CLARK
2012-06-27 9:54 ` Artem Bityutskiy
2012-06-27 12:37 ` Angus CLARK [this message]
2012-06-29 10:31 ` Artem Bityutskiy
2012-07-02 7:14 ` Angus CLARK
2012-07-03 12:22 ` Artem Bityutskiy
2012-07-03 15:05 ` Angus CLARK
2012-07-16 14:37 ` Artem Bityutskiy
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=4FEAFE73.2040303@st.com \
--to=angus.clark@st.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=shmulik.ladkani@gmail.com \
/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).