From: Artem Bityutskiy <dedekind1@gmail.com>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: linux equivalent of u-boot's "nand scrub" (erasing blocks even when OOB says "bad")
Date: Fri, 24 Sep 2010 11:47:06 +0300 [thread overview]
Message-ID: <1285318026.29268.162.camel@localhost> (raw)
In-Reply-To: <AANLkTinFYHz9Ncw9NWPgQoAM=8H7S9J11Gaybsrov1AT@mail.gmail.com>
On Thu, 2010-09-23 at 15:55 -0400, Mike Frysinger wrote:
> On Thu, Sep 23, 2010 at 08:28, Artem Bityutskiy wrote:
> > On Wed, 2010-09-22 at 03:43 -0400, Mike Frysinger wrote:
> >> here's a POC that works for me. with a simple tweak to `flash_eraseall`, i
> >> can now recover my mtd devices with funky OOB layouts.
> >>
> >> ive only extended MEMERASE64 as i believe the non-64 variants are EOL ? or
> >> should i also extend the 32bit interface as well ?
> >
> > We need something consistent. This patch will just erase the bad
> > eraseblock. This will not mark it as good in the BBT (neither in-ram nor
> > on-flash). If the erasure succeeds, the block will still be marked as
> > bad in BBT, but after reboot, if the BBT is not on-flash, it will be
> > treated as good eraseblock, because scanning will not find the bad block
> > marker anymore. If the BBT is on-flash, it'll stay bad. This is
> > inconsistent.
>
> i dont think the current BBT API supports marking bad blocks as good ?
> if it does, could you highlight it for me ?
No, unfortunately, it'd require some work with ancient code - not very
easy task, IMO.
> >> +struct erase_info_user64_flags {
> >> + __u64 start;
> >> + __u64 length;
> >> + __u32 flags;
> >> +};
> >
> > I think it needs to have som more room for possible future extentions.
> > Also, good tone for ioctls is to make them to be multiple of 64-bit -
> > less pain in mixed 32/64 bit setups.
> >
> > Please, add some
> >
> > u8 padding[12]
> >
> > field and add a comment that this has to be zero, and may be used in
> > future.
> >
> > Then in future we may extend ioctls and add more fields.
>
> well, the idea i have with flags is that we carve one bit out to mean
> "extend". so if in the future we wanted to extend the struct, we set
> that flag and the kernel knows that userspace wants the larger
> version. that gives you a way of extending things indefinitely at the
> cost of 1 bit.
I think this is not fast-path and it does not hurt to have extra fields
just in case someone else needs them in future.
Also, make sure size of this structure is multiple of 8, not 4.
> which also means i should probably carve that bit out now and have the
> kernel return an error when it is set today.
I think no, you should ignore them. But you should write a comment that
userspace has to zero them, this is kind of part of API. Then when new
flags are added, old kernels will not fail, but ignore them.
But yes, this will work only if userspace follows the API.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
next prev parent reply other threads:[~2010-09-24 8:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-10 23:53 linux equivalent of u-boot's "nand scrub" (erasing blocks even when OOB says "bad") Mike Frysinger
2010-09-11 6:32 ` Artem Bityutskiy
2010-09-12 4:03 ` Mike Frysinger
2010-09-12 7:54 ` Artem Bityutskiy
2010-09-22 7:43 ` Mike Frysinger
2010-09-23 12:28 ` Artem Bityutskiy
2010-09-23 19:55 ` Mike Frysinger
2010-09-24 8:47 ` Artem Bityutskiy [this message]
2010-09-13 5:54 ` linux equivalent of u-boot's "nand scrub" (erasing blocks even whenOOB " Jon Povey
2010-09-13 6:25 ` Artem Bityutskiy
2010-09-14 1:16 ` Mike Frysinger
2010-09-14 1:53 ` Jon Povey
2010-09-14 1:59 ` Mike Frysinger
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=1285318026.29268.162.camel@localhost \
--to=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=vapier.adi@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).