summaryrefslogtreecommitdiff
path: root/fs/jffs2/wbuf.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-05-05 12:52:49 +0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-05-05 12:52:49 +0400
commit3fddb6c985e3823c991399840d2d5ef5940e1b60 (patch)
treed8da4d00e1c66eca503c511913532e6d98ea0ab2 /fs/jffs2/wbuf.c
parent693ef66d8914f50cb899b5268676ea508d1f3178 (diff)
downloadlinux-3fddb6c985e3823c991399840d2d5ef5940e1b60.tar.xz
[JFFS2] Don't advance c->wbuf_ofs to next eraseblock after wbuf flush
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>
Diffstat (limited to 'fs/jffs2/wbuf.c')
-rw-r--r--fs/jffs2/wbuf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index c556e85a565c..91d1d0f1c66c 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -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;
}