Commit 3a0592b1 authored by Artem Bityutskiy's avatar Artem Bityutskiy

Revert "UBI: use mtd->writebufsize to set minimal I/O unit size"

This reverts commit a121f643.

Unfortunately, this commit breaks UBIFS backward compatibility and
makes new UBIFS refuse older UBIFS-formatted media:

UBIFS error: validate_sb: min. I/O unit mismatch: 8 in superblock, 64 real

Thus, we have to revert this patch and work on a better solution.
Reported-by: default avatarHolger Brunck <holger.brunck@keymile.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 1bae4ce2
...@@ -672,33 +672,7 @@ static int io_init(struct ubi_device *ubi) ...@@ -672,33 +672,7 @@ static int io_init(struct ubi_device *ubi)
ubi->nor_flash = 1; ubi->nor_flash = 1;
} }
/* ubi->min_io_size = ubi->mtd->writesize;
* Set UBI min. I/O size (@ubi->min_io_size). We use @mtd->writebufsize
* for these purposes, not @mtd->writesize. At the moment this does not
* matter for NAND, because currently @mtd->writebufsize is equivalent to
* @mtd->writesize for all NANDs. However, some CFI NOR flashes may
* have @mtd->writebufsize which is multiple of @mtd->writesize.
*
* The reason we use @mtd->writebufsize for @ubi->min_io_size is that
* UBI and UBIFS recovery algorithms rely on the fact that if there was
* an unclean power cut, then we can find offset of the last corrupted
* node, align the offset to @ubi->min_io_size, read the rest of the
* eraseblock starting from this offset, and check whether there are
* only 0xFF bytes. If yes, then we are probably dealing with a
* corruption caused by a power cut, if not, then this is probably some
* severe corruption.
*
* Thus, we have to use the maximum write unit size of the flash, which
* is @mtd->writebufsize, because @mtd->writesize is the minimum write
* size, not the maximum.
*/
if (ubi->mtd->type == MTD_NANDFLASH)
ubi_assert(ubi->mtd->writebufsize == ubi->mtd->writesize);
else if (ubi->mtd->type == MTD_NORFLASH)
ubi_assert(ubi->mtd->writebufsize % ubi->mtd->writesize == 0);
ubi->min_io_size = ubi->mtd->writebufsize;
ubi->hdrs_min_io_size = ubi->mtd->writesize >> ubi->mtd->subpage_sft; ubi->hdrs_min_io_size = ubi->mtd->writesize >> ubi->mtd->subpage_sft;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment