Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: adapt writebufsize calculation for concat

If different chips with different writebufsize are concatenated,
the writebufsize from the concat device has to be taken from
the device with the largest writebuffer. This writebufsize
is used later on in the UBI layer for the min I/O size.

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Holger Brunck and committed by
David Woodhouse
771df619 cbc6c5e7

+7 -1
+7 -1
drivers/mtd/mtdconcat.c
··· 750 750 struct mtd_concat *concat; 751 751 uint32_t max_erasesize, curr_erasesize; 752 752 int num_erase_region; 753 + int max_writebufsize = 0; 753 754 754 755 printk(KERN_NOTICE "Concatenating MTD devices:\n"); 755 756 for (i = 0; i < num_devs; i++) ··· 777 776 concat->mtd.size = subdev[0]->size; 778 777 concat->mtd.erasesize = subdev[0]->erasesize; 779 778 concat->mtd.writesize = subdev[0]->writesize; 780 - concat->mtd.writebufsize = subdev[0]->writebufsize; 779 + 780 + for (i = 0; i < num_devs; i++) 781 + if (max_writebufsize < subdev[i]->writebufsize) 782 + max_writebufsize = subdev[i]->writebufsize; 783 + concat->mtd.writebufsize = max_writebufsize; 784 + 781 785 concat->mtd.subpage_sft = subdev[0]->subpage_sft; 782 786 concat->mtd.oobsize = subdev[0]->oobsize; 783 787 concat->mtd.oobavail = subdev[0]->oobavail;