]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[JFFS2] Don't advance c->wbuf_ofs to next eraseblock after wbuf flush
authorDavid Woodhouse <dwmw2@infradead.org>
Sat, 5 May 2007 08:52:49 +0000 (09:52 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Sat, 5 May 2007 08:52:49 +0000 (09:52 +0100)
After flushing the last page of an eraseblock, don't leave the
wbuf 'offset' field pointing at the start of the next physical
eraseblock. This was causing a BUG() on NOR-ECC (Sibley) flash, where
we start writing a little further in, after the cleanmarker.

Debugged by Alexander Belyakov <abelyako@googlemail.com>

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
fs/jffs2/wbuf.c

index c556e85a565cea44fbceca308514fa51e5c80c3e..91d1d0f1c66c72c1d0c925d383f8e2a02973e2c4 100644 (file)
@@ -637,7 +637,10 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
 
        memset(c->wbuf,0xff,c->wbuf_pagesize);
        /* adjust write buffer offset, else we get a non contiguous write bug */
-       c->wbuf_ofs += c->wbuf_pagesize;
+       if (SECTOR_ADDR(c->wbuf_ofs) == SECTOR_ADDR(c->wbuf_ofs+c->wbuf_pagesize))
+               c->wbuf_ofs += c->wbuf_pagesize;
+       else
+               c->wbuf_ofs = 0xffffffff;
        c->wbuf_len = 0;
        return 0;
 }