UBI: improve corrupted flash handling
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 30 Apr 2010 10:02:33 +0000 (13:02 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 4 Jun 2010 08:30:44 +0000 (11:30 +0300)
commit0798cea8c2e1afee59686c51d27d0e96b05e42d1
tree7bc5702e9bdeb37699f3cce0d4641d15676e74f2
parent33789fb9d4470e27d18596c0966339e2ca8865a9
UBI: improve corrupted flash handling

This patch improves the way UBI handles corrupted flash, or flash
containing garbage or non-UBI data, which is the same from UBI POW.
Namely, we do the following:

* if 5% or more PEBs are corrupted, refuse the flash
* if less than 5% PEBs are corrupted, do not refuse the flash
  and format these PEBs
* if less than 8 PEBs are corrupted, format them silently, otherwise
  print a warning message.

Reported-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Tested-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
drivers/mtd/ubi/scan.c