Skip to content

Commit

Permalink
[JFFS2] Write buffer offset adjustment for NOR-ECC (Sibley) flash
Browse files Browse the repository at this point in the history
After choosing new c->nextblock, don't leave the wbuf offset field
occasionally pointing at the start of the next physical eraseblock.
This was causing a BUG() on NOR-ECC (Sibley) flash, where we start
writing after the cleanmarker.

Among other this fix should cover write buffer offset adjustment
after flushing the last page of an eraseblock.

Signed-off-by: Alexander Belyakov <abelyako@googlemail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Alexander Belyakov authored and David Woodhouse committed Oct 18, 2008
1 parent 43b5693 commit 5bf1723
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 4 additions & 0 deletions fs/jffs2/nodemgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)

jffs2_sum_reset_collected(c->summary); /* reset collected summary */

/* adjust write buffer offset, else we get a non contiguous write bug */
if (!(c->wbuf_ofs % c->sector_size) && !c->wbuf_len)
c->wbuf_ofs = 0xffffffff;

D1(printk(KERN_DEBUG "jffs2_find_nextblock(): new nextblock = 0x%08x\n", c->nextblock->offset));

return 0;
Expand Down
5 changes: 1 addition & 4 deletions fs/jffs2/wbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,10 +679,7 @@ 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 */
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_ofs += c->wbuf_pagesize;
c->wbuf_len = 0;
return 0;
}
Expand Down

0 comments on commit 5bf1723

Please sign in to comment.