diff mbox

[U-Boot,1/6] mtd: add writebufsize field to mtd_info struct

Message ID 1295540225-11083-1-git-send-email-holger.brunck@keymile.com
State Rejected
Delegated to: Stefan Roese
Headers show

Commit Message

Holger Brunck Jan. 20, 2011, 4:17 p.m. UTC
This field will be used to indicate the write buffer size
of the MTD device. UBI will set it's minimal I/O unit size
(min_io_size) to the indicated write buffer size. By this
change we intend to fix failed recovery of UBIFS partitions
we currently observe on NOR flash when mounting the partition
after unclean unmount.

Currently the min_io_size is set to mtd->writesize (which is 1
byte for NOR flash). But flash programming is often done from
prepared write buffer containing multiple bytes and is performed
in one programming operation which could be interrupted by a power
cut or a system reset causing corrupted (partially written) areas
in a flash sector. Knowing the size of potentially corrupted areas
UBIFS scanning and recovery algorithms are able to perform
successful recovery.

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
---
 include/linux/mtd/mtd.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Comments

Detlev Zundel Jan. 27, 2011, 4:18 p.m. UTC | #1
Hi Stefan,

do you have any comment on this series?  I delegated the patches to you
in patchwork already :)  No seriously, the patches look sane and are in
accordance to what is done in Linux....

> This field will be used to indicate the write buffer size
> of the MTD device. UBI will set it's minimal I/O unit size
> (min_io_size) to the indicated write buffer size. By this
> change we intend to fix failed recovery of UBIFS partitions
> we currently observe on NOR flash when mounting the partition
> after unclean unmount.
>
> Currently the min_io_size is set to mtd->writesize (which is 1
> byte for NOR flash). But flash programming is often done from
> prepared write buffer containing multiple bytes and is performed
> in one programming operation which could be interrupted by a power
> cut or a system reset causing corrupted (partially written) areas
> in a flash sector. Knowing the size of potentially corrupted areas
> UBIFS scanning and recovery algorithms are able to perform
> successful recovery.
>
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>

Thanks
  Detlev
Holger Brunck Feb. 1, 2011, 8:26 a.m. UTC | #2
Hi Detlev,

Detlev Zundel wrote:
> Hi Stefan,
> 
> do you have any comment on this series?  I delegated the patches to you
> in patchwork already :)  No seriously, the patches look sane and are in
> accordance to what is done in Linux....
> 
>> This field will be used to indicate the write buffer size
>> of the MTD device. UBI will set it's minimal I/O unit size
>> (min_io_size) to the indicated write buffer size. By this
>> change we intend to fix failed recovery of UBIFS partitions
>> we currently observe on NOR flash when mounting the partition
>> after unclean unmount.
>>
>> Currently the min_io_size is set to mtd->writesize (which is 1
>> byte for NOR flash). But flash programming is often done from
>> prepared write buffer containing multiple bytes and is performed
>> in one programming operation which could be interrupted by a power
>> cut or a system reset causing corrupted (partially written) areas
>> in a flash sector. Knowing the size of potentially corrupted areas
>> UBIFS scanning and recovery algorithms are able to perform
>> successful recovery.
>>
>> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> 

as I told in another mail, the min I/O size adaption patch leads to
incompatibilites for the UBIFS and therefore the similar patch in linux kernel
was reverted. But anyway the first five patches in the patch serie are already
part of the mtd layer of the linux kernel.

So the patches 1-5 of this series can also be committed to u-boot. Whats your
opinion?

Regards
Holger Brunck
Stefan Roese Feb. 1, 2011, 9:28 a.m. UTC | #3
Hi Holger & Detlev,

On Tuesday 01 February 2011 09:26:56 Holger Brunck wrote:
> > do you have any comment on this series?  I delegated the patches to you
> > in patchwork already :)  No seriously, the patches look sane and are in
> > accordance to what is done in Linux....

I'm back from vacation now and slowly picking up...
 
> >> This field will be used to indicate the write buffer size
> >> of the MTD device. UBI will set it's minimal I/O unit size
> >> (min_io_size) to the indicated write buffer size. By this
> >> change we intend to fix failed recovery of UBIFS partitions
> >> we currently observe on NOR flash when mounting the partition
> >> after unclean unmount.
> >> 
> >> Currently the min_io_size is set to mtd->writesize (which is 1
> >> byte for NOR flash). But flash programming is often done from
> >> prepared write buffer containing multiple bytes and is performed
> >> in one programming operation which could be interrupted by a power
> >> cut or a system reset causing corrupted (partially written) areas
> >> in a flash sector. Knowing the size of potentially corrupted areas
> >> UBIFS scanning and recovery algorithms are able to perform
> >> successful recovery.
> >> 
> >> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> 
> as I told in another mail, the min I/O size adaption patch leads to
> incompatibilites for the UBIFS and therefore the similar patch in linux
> kernel was reverted. But anyway the first five patches in the patch serie
> are already part of the mtd layer of the linux kernel.
> 
> So the patches 1-5 of this series can also be committed to u-boot. Whats
> your opinion?

I have no problems with applying patches 1-5. But they have been submitted 
after the merge window was closed, so they will not make it into the next 
release.

I'm volunteering to push those patches into "next" (once its available) via 
one of my git repositories (UBI/UBIFS or CFI) if nobody else objects.

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de
Holger Brunck Feb. 1, 2011, 12:18 p.m. UTC | #4
Hi Stefan,

Stefan Roese wrote:
> 
>> as I told in another mail, the min I/O size adaption patch leads to
>> incompatibilites for the UBIFS and therefore the similar patch in linux
>> kernel was reverted. But anyway the first five patches in the patch serie
>> are already part of the mtd layer of the linux kernel.
>>
>> So the patches 1-5 of this series can also be committed to u-boot. Whats
>> your opinion?
> 
> I have no problems with applying patches 1-5. But they have been
> submitted after the merge window was closed, so they will not make it
> into the next release.
> 
> I'm volunteering to push those patches into "next" (once its available)
> via one of my git repositories (UBI/UBIFS or CFI) if nobody else objects.
> 

Ok, thanks.

Regards
Holger
diff mbox

Patch

diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 3b18d7d..14d6f70 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -129,6 +129,17 @@  struct mtd_info {
 	 */
 	u_int32_t writesize;
 
+	/*
+	 * Size of the write buffer used by the MTD. MTD devices having a write
+	 * buffer can write multiple writesize chunks at a time. E.g. while
+	 * writing 4 * writesize bytes to a device with 2 * writesize bytes
+	 * buffer the MTD driver can (but doesn't have to) do 2 writesize
+	 * operations, but not 4. Currently, all NANDs have writebufsize
+	 * equivalent to writesize (NAND page size). Some NOR flashes do have
+	 * writebufsize greater than writesize.
+	 */
+	u_int32_t writebufsize;
+
 	u_int32_t oobsize;   /* Amount of OOB data per block (e.g. 16) */
 	u_int32_t oobavail;  /* Available OOB bytes per block */