[PATCH]fs/jffs2/wbuf.c: add compatibility support for OOB data block

Artem B. Bityuckiy dedekind at infradead.org
Mon Aug 15 08:46:44 EDT 2005


On Mon, 2005-08-15 at 13:53 +0200, Jörn Engel wrote:

> David, my best idea right now would be to change the erase marker and
> add a field to it.  Doesn't really make me happy, though.  Do you have
> a better idea?
> 
> And while we're at it, why not create a new function for this code.
> Something like this:
> 
> int jffs2_check_erase_size(struct jffs2_sb_info *c)
> {
> 	size_t blocks;
> 
> 	c->sector_size = c->mtd->erasesize; 
> 	blocks = c->flash_size / c->sector_size;
> 	if (!(c->mtd->flags & MTD_NO_VIRTBLOCKS)) {
> 		while ((blocks * sizeof (struct jffs2_eraseblock))
> 				> (128 * 1024)) {
> 			blocks >>= 1;
> 			c->sector_size <<= 1;
> 		}	
> 	}
> 
> 	if (/* magic check about changed erase_size fails */)
> 		return -EIO;
> 	return 0;
> }

If we will have the same algorithm for calculating the size of virtual
block both in JFFS2 and in sumtool, the problem should go, isn't it?
User supplies sumtool with size of the eraseblock, sumtool knows the
size of struct jffs2_eraseblock, so it knows the virtual block size and
we're happy.





More information about the linux-mtd mailing list