UBI: always re-read in case of read failures
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sun, 31 Oct 2010 16:55:30 +0000 (18:55 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sun, 6 Feb 2011 17:35:26 +0000 (19:35 +0200)
When the read operation fails, UBI tries to re-read several times in
a hope that one of the subsequent reads may succeed. However, currently
UBI re-reads only if MTD failed to read all data, but does not re-reads
if all the data were read, but with an integrity error (-EBADMSB). This
patch makes UBI to always re-try reading.

This should be useful for reading NAND pages with unstable bits -
re-reading may help to get correct data.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/ubi/io.c

index 6f90a65301492fc723ee0b698fd42d432ac3a94a..889e25c4932352cfcd25ab165d5a59592416e92f 100644 (file)
@@ -188,7 +188,7 @@ retry:
                        return UBI_IO_BITFLIPS;
                }
 
-               if (read != len && retries++ < UBI_IO_RETRIES) {
+               if (retries++ < UBI_IO_RETRIES) {
                        dbg_io("error %d%s while reading %d bytes from PEB %d:%d,"
                               " read only %zd bytes, retry",
                               err, errstr, len, pnum, offset, read);