All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] MTD: Change meaning of -EUCLEAN return code on reads
@ 2012-03-11 21:21 Mike Dunn
  2012-03-11 21:21 ` [PATCH 1/4] MTD: add ecc_strength fields to mtd structs Mike Dunn
                   ` (4 more replies)
  0 siblings, 5 replies; 31+ messages in thread
From: Mike Dunn @ 2012-03-11 21:21 UTC (permalink / raw)
  To: linux-mtd; +Cc: Ivan Djelic, Mike Dunn

Hi,

This patchset addresses the problem of insufficient information being returned
by mtd_read() and mtd_read_oob() with regard to bit error corrections.
Currently -EUCLEAN is returned if one or more bit errors were corrected during
the course of the read operation.  Higher layers like UBI use this return code
as an indication that the erase block may be degrading and should be considered
as a candidate for being marked as a bad block.  The problem is that high bit
error rates are common on more recent NAND flash devices, which these devices
compensate for by using strong ecc algorithms.  Frequent (but entirely normal)
bit error corrections on these devices result in blocks being incorrectly marked
as bad.  On some devices, ubi/ubifs can not be reliably used because of this.

This problem was discussed a while back [1][2][3], and a consensus of sorts was
reached for a solution, which these patches implement.  The recent addition of
the mtd api entry functions now make this solution practical (thanks Artem!).  A
quick description of each patch will provide a synopsis of the patchset:

(1) The element 'ecc_strength' is added to struct mtd_info, which will store the
    maximum number of bit errors that can be corrected in one writesize region.

(2) Drivers set ecc_strength during initialization.

(3) The element 'euclean_threshold' is added to struct mtd_info.  If the driver
    leaves this uninitialized, mtd sets it to ecc_strength when the device or
    partition is registered.  This element is also exposed for reading and
    writing from userspace through sysfs.

(4) The drivers' read methods, absent an error, return a non-negative integer
    indicating the maximum number of bit errors that were corrected in any one
    writesize region.  MTD returns -EUCLEAN if this is >= euclean_threshold, 0
    otherwise.

So basically, the meaning of -EUCLEAN is changed from "one or more bit errors
were corrected over the entire read operation", to "a dangerously high number of
bit errors were corrected on one or more writesize regions".  By default,
"dangerously high" is interpreted as the maximum number of correctible bit
errors per writesize.  Drivers can specify a different value, and the user can
override it if more or less caution regarding data integrity is desired.

Patch #2 touches a lot of files, but they are small changes in most cases.  If
you can verify the correctness of the device's ecc strength, an ACK would be
much appreciated!

And of course general reviews greatly appreciated.  Thanks!

[1] http://lists.infradead.org/pipermail/linux-mtd/2011-December/038755.html
[2] http://lists.infradead.org/pipermail/linux-mtd/2011-December/038688.html
[3] http://lists.infradead.org/pipermail/linux-mtd/2011-December/038828.html

Mike Dunn (4):
  MTD: add ecc_strength fields to mtd structs
  MTD: flash drivers set ecc strength
  MTD: euclean_threshold added to mtd_info and sysfs
  MTD: drivers return max_bitflips, mtd returns -EUCLEAN

 Documentation/ABI/testing/sysfs-class-mtd |   23 ++++++++++
 drivers/mtd/devices/doc2000.c             |    1 +
 drivers/mtd/devices/doc2001.c             |    1 +
 drivers/mtd/devices/doc2001plus.c         |    1 +
 drivers/mtd/devices/docg3.c               |    5 ++-
 drivers/mtd/mtdcore.c                     |   68 ++++++++++++++++++++++++++++-
 drivers/mtd/mtdpart.c                     |   26 ++++++-----
 drivers/mtd/nand/alauda.c                 |    5 +-
 drivers/mtd/nand/atmel_nand.c             |    1 +
 drivers/mtd/nand/bcm_umi_nand.c           |    8 +++
 drivers/mtd/nand/bf5xx_nand.c             |    2 +
 drivers/mtd/nand/cafe_nand.c              |    1 +
 drivers/mtd/nand/cs553x_nand.c            |    2 +
 drivers/mtd/nand/davinci_nand.c           |    1 +
 drivers/mtd/nand/denali.c                 |    3 +
 drivers/mtd/nand/diskonchip.c             |    1 +
 drivers/mtd/nand/docg4.c                  |    1 +
 drivers/mtd/nand/fsl_elbc_nand.c          |    6 +++
 drivers/mtd/nand/fsmc_nand.c              |    2 +
 drivers/mtd/nand/jz4740_nand.c            |    5 ++
 drivers/mtd/nand/mxc_nand.c               |    7 +++
 drivers/mtd/nand/nand_base.c              |   21 ++++++++-
 drivers/mtd/nand/ndfc.c                   |    1 +
 drivers/mtd/nand/omap2.c                  |    1 +
 drivers/mtd/nand/pxa3xx_nand.c            |    1 +
 drivers/mtd/nand/r852.c                   |    1 +
 drivers/mtd/nand/rtc_from4.c              |    1 +
 drivers/mtd/nand/s3c2410.c                |    1 +
 drivers/mtd/nand/sh_flctl.c               |    1 +
 drivers/mtd/nand/sharpsl.c                |    1 +
 drivers/mtd/nand/tmio_nand.c              |    1 +
 drivers/mtd/nand/txx9ndfmc.c              |    1 +
 drivers/mtd/onenand/onenand_base.c        |    7 ++-
 include/linux/mtd/mtd.h                   |   20 +++++----
 include/linux/mtd/nand.h                  |    2 +
 35 files changed, 200 insertions(+), 30 deletions(-)

-- 
1.7.3.4

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2012-04-13 18:18 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-11 21:21 [PATCH 0/4] MTD: Change meaning of -EUCLEAN return code on reads Mike Dunn
2012-03-11 21:21 ` [PATCH 1/4] MTD: add ecc_strength fields to mtd structs Mike Dunn
2012-03-13 12:25   ` Artem Bityutskiy
2012-03-11 21:21 ` [PATCH 2/4] MTD: flash drivers set ecc strength Mike Dunn
2012-03-13 12:27   ` Artem Bityutskiy
2012-03-16 14:13   ` Ivan Djelic
2012-03-16 20:02     ` Mike Dunn
2012-03-29 17:24   ` Brian Norris
2012-03-31  0:05     ` Mike Dunn
2012-04-02 17:34     ` Mike Dunn
2012-04-03  8:03       ` Ivan Djelic
2012-03-11 21:21 ` [PATCH 3/4] MTD: euclean_threshold added to mtd_info and sysfs Mike Dunn
2012-03-13 12:29   ` Artem Bityutskiy
2012-03-11 21:21 ` [PATCH 4/4] MTD: drivers return max_bitflips, mtd returns -EUCLEAN Mike Dunn
2012-03-14 11:05   ` Shmulik Ladkani
2012-03-14 11:45     ` Shmulik Ladkani
2012-03-29 17:30   ` Brian Norris
2012-03-30 12:13     ` Artem Bityutskiy
2012-03-31  1:17       ` Mike Dunn
2012-04-02  7:17         ` Artem Bityutskiy
2012-04-02 15:33           ` Mike Dunn
2012-03-31  1:05     ` Mike Dunn
2012-03-31  6:37       ` Shmulik Ladkani
2012-04-02 16:40         ` Mike Dunn
2012-04-03  8:48           ` Shmulik Ladkani
2012-04-13 15:54             ` Artem Bityutskiy
2012-04-13 18:18               ` Mike Dunn
2012-03-13 12:03 ` [PATCH 0/4] MTD: Change meaning of -EUCLEAN return code on reads Artem Bityutskiy
2012-03-13 17:46   ` Mike Dunn
2012-03-13 22:14     ` Mike Dunn
2012-03-14 10:56     ` Artem Bityutskiy

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.