mtd: nand: wait to set BBT version
authorBrian Norris <computersforpeace@gmail.com>
Wed, 21 Sep 2011 01:35:57 +0000 (18:35 -0700)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 21 Sep 2011 06:19:08 +0000 (09:19 +0300)
commitdadc17a3e34810ed411a62e6b4cafdf3e5e1d5c8
treed8cc96a7f3109126c2c73cc5ce98102f901387d5
parent623978de362a5faeb18d8395fa86089650642626
mtd: nand: wait to set BBT version

Because there are so many cases of checking, writing, and re-writing of
the bad block table(s), we might as well wait until the we've settled on
a valid, clean copy of the table. This also prevents us from falsely
incrementing the table version. For example, we may have the following:

  Primary table, with version 0x02
  Mirror table, with version 0x01
  Primary table has uncorrectable ECC errors

If we don't have this fix applied, then we will:

  Choose to read the primary table (higher version)
  Set mirror table version to 0x02
  Read back primary table
  Invalidate table because of ECC errors
  Retry readback operation with mirror table, now version 0x02
  Mirrored table reads cleanly
  Writeback BBT to primary table location (with "version 0x02")

However, the mirrored table shouldn't have a new version number.
Instead, we actually want:

  Choose to read the primary table (higher version)
  Read back primary table
  Invalidate table because of ECC errors
  Retry readback with mirror table (version 0x01)
  Mirrored table reads cleanly
  Set both tables to version 0x01
  Writeback BBT to primary table location (version 0x01)

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
drivers/mtd/nand/nand_bbt.c
This page took 0.026946 seconds and 5 git commands to generate.