mtd/fs/jffs2 fs.c,1.43,1.44

gleixner at infradead.org gleixner at infradead.org
Thu May 27 08:05:13 EDT 2004


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv16596

Modified Files:
	fs.c 
Log Message:
Fix alignement check. Reduce total size if its not sector aligned. Signed-off-by: Thomas Gleixner <tglx at linutronix.de>

Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- fs.c	7 May 2004 16:00:31 -0000	1.43
+++ fs.c	27 May 2004 12:05:11 -0000	1.44
@@ -454,17 +454,20 @@
 	 * Check, if we have to concatenate physical blocks to larger virtual blocks
 	 * to reduce the memorysize for c->blocks. (kmalloc allows max. 128K allocation)
 	 */
-	blocks = c->flash_size / c->mtd->erasesize;
-	while ((blocks * sizeof (struct jffs2_eraseblock)) > (128 * 1024))
+	c->sector_size = c->mtd->erasesize; 
+	blocks = c->flash_size / c->sector_size;
+	while ((blocks * sizeof (struct jffs2_eraseblock)) > (128 * 1024)) {
 		blocks >>= 1;
+		c->sector_size <<= 1;
+	}	
 	
-	c->sector_size = c->flash_size / blocks;
 	/*
 	 * Size alignment check
 	 */
 	if ((c->sector_size * blocks) != c->flash_size) {
-		printk(KERN_ERR "jffs2: Flash size not aligned to erasesize\n");
-		return -EINVAL;
+		c->flash_size = c->sector_size * blocks;		
+		printk(KERN_INFO "jffs2: Flash size not aligned to erasesize, reducing to %dKiB\n",
+			c->flash_size / 1024);
 	}
 
 	if (c->sector_size != c->mtd->erasesize)





More information about the linux-mtd-cvs mailing list