[Resent with proper line wrap] Request for comments: UBI PEBs as a multiple of erase size

Kevin Paul Herbert kevin.herbert at meraki.net
Wed Sep 14 01:21:20 EDT 2011


[Sorry for the ugly lack of line-wrap... I thought I knew better. :-)]

I came across a situation where I wanted to be able to use the same pre-built
(with UBI) image on two different FLASH devices, one of which having a
larger erase size than the other. I actually did not notice that the device
I was using had a different erase size, which caused UBI to quietly corrupt
my FLASH.

I have a patch to UBI (kernel and ubinize) to store the size of a PEB in
the EC header, reject attaching if the PEB size is not equal to or an
integer multiple of the erase size, and treat multiple erase blocks
as a "cluster" for I/O operations.

I looked through a few months of archives to see if this is a common
problem, and I don't see this as being discussed. Is there interest in
me publishing this patch for inclusion in the kernel. The only
downside I can see of my change is that it adds an additional 32 bit
quantity to struct ubi_ec_hdr, reducing the available free header bytes
from 35 to 31. For backwards compatibility, if this field is zero,
I treat it as PEB size == erase size.

It seems to me that having the PEB size in the header, regardless of
supporting multiple erase blocks as a single PEB, is a useful consistency
check.




More information about the linux-mtd mailing list