1:1 mapping

Artem B. Bityutskiy dedekind at infradead.org
Thu Sep 22 09:41:44 EDT 2005


On Thu, 2005-09-22 at 15:21 +0200, Jörn Engel wrote:
> If you have a better idea, please speak up.  This beats an
> incompatible option by far, imo.  We could also do something like
> this:
> 
> int jffs2_blocks_use_vmalloc(struct jffs2_sb_info *c)
> {
> 	int ret = ((c->flash_size / c->sector_size) * sizeof (struct jffs2_eraseblock)) > (128 * 1024);
> 	if (unlikely(ret)) {
> 		printk(KERN_ERR "Please read up on the virtual mapping stuff");
> 		BUG();
> 	}
> 	return ret;
> }

Agreed, but with 2 notes:

1. a distinct function should be created which is invoked when JFFS2 has
detected that the image is an old image:

int safe_to_mount(struct jffs2_sb_info *c)
{
	int virtual;
	virtual = ((c->flash_size / c->sector_size) * JFFS2_LEGACY_EB_SIZE > (128 * 1024);
	if (virtual)
		return 0;
	return 1;
}

Where JFFS2_LEGACY_EB_SIZE = sizeof(struct jffs2_eraseblock) of old
JFFS2.

2. No need to invoke BUG(), it is enough just to return an error and let
JFFS2 cleanly reject mounting the image.

3. No need to add any additional config option, it is enough to describe
this on the MTD site and in a readme.

-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.





More information about the linux-mtd mailing list