[PATCH] remove support for virtual blocks

Jörn Engel joern at wohnheim.fh-wedel.de
Mon Aug 29 06:26:54 EDT 2005


On Sun, 28 August 2005 11:46:16 +0200, Ferenc Havasi wrote:
> 
> Maybe we should use (temporary) vmalloc here instead of simply throwing 
> a BUG(). It's slower I know, but slow working is still better than not 
> working.

That sounded like a good idea, until I had a look at the code.
Basically, we shouldn't use vmalloc, unless we have to.  Using both
kmalloc and vmalloc means that we have to remember our choice of
allocation somewhere.  And once we do that, it's quite a bit of code
and complexity.

All that brainpower should rather go into a decent patch.

But here is the next best thing.  Note the third printk line.

Jörn

-- 
A defeated army first battles and then seeks victory.
-- Sun Tzu



Signed-off-by: Jörn Engel <joern at wohnheim.fh-wedel.de>
---

 fs/jffs2/fs.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

--- linux-2.6.13-rc6mtd/fs/jffs2/fs.c~jffs2_remove_virtual_mapping	2005-08-26 17:18:04.000000000 +0200
+++ linux-2.6.13-rc6mtd/fs/jffs2/fs.c	2005-08-29 12:23:06.000000000 +0200
@@ -468,11 +468,12 @@ int jffs2_do_fill_super(struct super_blo
 	 */
 	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 (!(c->mtd->flags & MTD_NO_VIRTBLOCKS) && (blocks * sizeof (struct jffs2_eraseblock)) > (128 * 1024)) {
+		printk(KERN_ERR "jffs2: Support for virtual blocks was removed\n"
+				"	Please contact JFFS2 maintainers about this.\n"
+				"	Alternative, add the flag 'MTD_NO_VIRTBLOCKS' to your mapping driver\n");
+		BUG();
+		return -EIO;
 	}
 
 	/*




More information about the linux-mtd mailing list