1:1 mapping

Jörn Engel joern at wohnheim.fh-wedel.de
Thu Sep 22 09:48:11 EDT 2005


On Thu, 22 September 2005 17:41:44 +0400, Artem B. Bityutskiy wrote:
> 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:

Can you explain "when JFFS2 has detected that the image is an old
image" in C?

> 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.

32bit or 64bit?  I guess using the size of 64bit, possibly adding a
little for safety, should be fine.

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

Fine with me.

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

Fine with me.

Jörn

-- 
Homo Sapiens is a goal, not a description.
-- unknown




More information about the linux-mtd mailing list