JFFS2 wbuf non-contiguous write bug

Alexander Belyakov abelyako at googlemail.com
Fri Jun 30 07:18:43 EDT 2006


On 6/29/06, Jörn Engel <joern at wohnheim.fh-wedel.de> wrote:
>
> Next question is: does the check against sibley/nor_ecc make sense?
> Would the code hurt anyone if it was enabled for nand and dataflash as
> well?
>

It seems the following patch (with unconditional wbuf fixup) works
with both Sibley and NAND. At least holey.c test passed.


Signed-off-by: Alexander Belyakov <alexander.belyakov at intel.com>

diff -uNr a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
--- a/fs/jffs2/wbuf.c	2006-06-29 12:28:33.000000000 +0400
+++ b/fs/jffs2/wbuf.c	2006-06-30 11:45:33.000000000 +0400
@@ -754,6 +754,13 @@
 		memset(c->wbuf,0xff,c->wbuf_pagesize);
 	}

+	/* Fixup the wbuf if we are moving to a new eraseblock */
+	if (((c->wbuf_ofs % c->sector_size) == 0) && !c->wbuf_len) {
+		c->wbuf_ofs = PAGE_DIV(to);
+		c->wbuf_len = PAGE_MOD(to);
+		memset(c->wbuf,0xff,c->wbuf_pagesize);
+	}
+
 	/*
 	 * Sanity checks on target address.  It's permitted to write
 	 * at PAD(c->wbuf_len+c->wbuf_ofs), and it's permitted to




More information about the linux-mtd mailing list