From: Norbert van Bolhuis <nvbolhuis@aimvalley.nl>
To: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Eric_Holmberg@trimble.com, Anatolij Gustschin <agust@denx.de>,
linux-mtd@lists.infradead.org, boaz ben david <boazbd@gmail.com>,
Detlev Zundel <dzu@denx.de>
Subject: Re: UBIFS partition on NOR flash not mountable after power cut test
Date: Wed, 01 Dec 2010 14:06:49 +0100 [thread overview]
Message-ID: <4CF64869.4020902@aimvalley.nl> (raw)
In-Reply-To: <AANLkTikci0e2jaHCarA9HG86b_C-1UUcT_PMy-Q_mBrP@mail.gmail.com>
Artem Bityutskiy wrote:
> On Wed, Dec 1, 2010 at 11:55 AM, Anatolij Gustschin <agust@denx.de> wrote:
>
>> On Tue, 30 Nov 2010 20:18:56 +0200
>> boaz ben david <boazbd@gmail.com> wrote:
>>
>>> Sorry to bump the thread but I'm having issues which I think are similiar
>>> with MLC NAND flash.
>>> Will reducing the write buffer help here too?
>> I don't know. Your issues may look similar but without
>> knowing the details it is not possible to say. Most
>> probably no. I reduced the write buffer size in the CFI
>> driver. The issues we observed seem to be NOR flash
>> specific.
>>
>
> Hi,
>
> let me try to explain this. Both UBI and UBIFS have a notion of min_io_size.
> It is
> NAND page size in case of NAND. In case of NOR, UBI reports min_io_size as
> 1.
> So UBI assumes NOR flash writes one byte at a time.
>
> Since UBIFS align all flash nodes to 8 bytes, UBIFS assumes min_io_size for
> NOR is 8 bytes. See fs/ubifs/super.c:
>
> /*
> * UBIFS aligns all node to 8-byte boundary, so to make function in
> * io.c simpler, assume minimum I/O unit size to be 8 bytes if it is
> * less than 8.
> */
> if (c->min_io_size < 8) {
> c->min_io_size = 8;
> c->min_io_shift = 3;
> }
>
> Then the UBIFS scanning and recovery code is trying to be very picky about
> how
> nodes are corrupted. We wanted to distinguish between corruptions caused by
> power cuts and corruptions caused by something else. UBIFS policy is that it
> should
> gracefully recover from all corruptions cause by power cuts, and it does not
> try to
> recover from other types of corruptions.
>
> Thus, in journal recovery code, if we see that we have good node, good node,
> good
> node, then some trash, we analyse this trash. We check that the amount of
> trash is
> not longer than maximum UBIFS node size aligned up to min_io_size, and then
> after
> this go all 0xFFs. And some other checks. See no_more_nodes() function.
>
> In your case what happens is that we look that the amount of corrupted data
> is longer
> than common header size (all nodes start with the common header) aligned up
> to
> the min_io_size. And since we assume data is written min_io_size bytes at a
> time
> (8 bytes, next 8 bytes, etc in your case), we assume that the common header
> was
> successfully written, and we check it. But it is corrupted in your case,
> simply because
> you write 64 bytes at a time, no 8. And we reject the flash.
>
> So all you need to do is to teach UBIFS to look at CFI write buffer size,
> and make
> min_io_size to be the same. Then it should work fine.
>
> Try hacking UBIFS and make min_io_size to be 64. If it works, you can
> provide a
> nice solution - add corresponding field to mtd_info structure and teach UBI
> to look
> at it.
>
A while ago I hacked mtd/ubi to hold CFI write buffer size in oobsize
in case of NOR flash. We have NOR devices with 64 (SPANSION) and 1024
(Numonyx™ Axcell™ M29EW) bytes write buffer size.
I never submitted it to this list because I considered it a hack
(and was rather busy).
I'm even more busy now, but I can cook up the patches and send them if
you want (hopefully I have time this evening or tomorrow).
It's only for testing (private kernel) since I assume it's not acceptable
to abuse oobsize this way (for NOR flash) ?
---
N. van Bolhuis.
next prev parent reply other threads:[~2010-12-01 13:07 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-29 18:50 UBIFS partition on NOR flash not mountable after power cut test Anatolij Gustschin
2010-11-29 20:33 ` Mark Mason
2010-12-02 3:47 ` Artem Bityutskiy
2010-12-02 4:10 ` Mark Mason
2010-12-02 9:17 ` Detlev Zundel
2010-11-30 10:41 ` Norbert van Bolhuis
2010-11-30 15:35 ` Anatolij Gustschin
2010-12-01 9:38 ` Anatolij Gustschin
[not found] ` <AANLkTikEDQyNttTcKgHLwhR53sYSFbtVK-oy2S3END46@mail.gmail.com>
2010-12-01 9:47 ` Norbert van Bolhuis
2010-12-01 9:55 ` Anatolij Gustschin
[not found] ` <AANLkTikci0e2jaHCarA9HG86b_C-1UUcT_PMy-Q_mBrP@mail.gmail.com>
2010-12-01 13:06 ` Norbert van Bolhuis [this message]
2010-12-02 3:51 ` Artem Bityutskiy
2010-12-01 12:05 ` Anatolij Gustschin
2010-12-01 15:44 ` Anatolij Gustschin
2010-12-02 4:01 ` Artem Bityutskiy
2010-12-02 4:42 ` Artem Bityutskiy
2010-12-02 9:46 ` Matthieu CASTET
2010-12-02 12:18 ` Artem Bityutskiy
2010-12-02 9:57 ` Anatolij Gustschin
2010-12-02 12:18 ` Artem Bityutskiy
2010-12-02 13:23 ` Anatolij Gustschin
2010-12-02 13:35 ` Artem Bityutskiy
2010-12-02 13:50 ` Anatolij Gustschin
2010-12-02 13:57 ` Artem Bityutskiy
2010-12-02 14:18 ` Anatolij Gustschin
2010-12-03 10:07 ` Anatolij Gustschin
2010-12-03 10:23 ` Anatolij Gustschin
2010-12-03 10:28 ` Artem Bityutskiy
2010-12-03 10:41 ` Anatolij Gustschin
2010-12-03 10:49 ` Artem Bityutskiy
2010-12-03 11:15 ` Anatolij Gustschin
2010-12-02 3:46 ` 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=4CF64869.4020902@aimvalley.nl \
--to=nvbolhuis@aimvalley.nl \
--cc=Eric_Holmberg@trimble.com \
--cc=agust@denx.de \
--cc=boazbd@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dzu@denx.de \
--cc=linux-mtd@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.