Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[JFFS2] Write buffer offset adjustment for NOR-ECC (Sibley) flash

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>

authored by

Alexander Belyakov and committed by
David Woodhouse
5bf17237 43b5693d

+5 -4
+4
fs/jffs2/nodemgmt.c
··· 261 261 262 262 jffs2_sum_reset_collected(c->summary); /* reset collected summary */ 263 263 264 + /* adjust write buffer offset, else we get a non contiguous write bug */ 265 + if (!(c->wbuf_ofs % c->sector_size) && !c->wbuf_len) 266 + c->wbuf_ofs = 0xffffffff; 267 + 264 268 D1(printk(KERN_DEBUG "jffs2_find_nextblock(): new nextblock = 0x%08x\n", c->nextblock->offset)); 265 269 266 270 return 0;
+1 -4
fs/jffs2/wbuf.c
··· 679 679 680 680 memset(c->wbuf,0xff,c->wbuf_pagesize); 681 681 /* adjust write buffer offset, else we get a non contiguous write bug */ 682 - if (SECTOR_ADDR(c->wbuf_ofs) == SECTOR_ADDR(c->wbuf_ofs+c->wbuf_pagesize)) 683 - c->wbuf_ofs += c->wbuf_pagesize; 684 - else 685 - c->wbuf_ofs = 0xffffffff; 682 + c->wbuf_ofs += c->wbuf_pagesize; 686 683 c->wbuf_len = 0; 687 684 return 0; 688 685 }