JFFS2 wbuf non-contiguous write bug

Alexander Belyakov abelyako at googlemail.com
Thu Jun 29 10:41:37 EDT 2006


On 6/29/06, Jörn Engel <joern at wohnheim.fh-wedel.de> wrote:
>
> How can that be?  The removed code was:
> -       if (jffs2_nor_ecc(c)) {
> -               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);
> -               }
> -       }
>
> And jffs2_nor_ecc(c) would have been false for Sibley (true for
> STMicro, though).  So if we have a bug for Sibley and adding this code
> solves the problem _now_, how could it have solved the problem
> _before_?
>

True. But actually that piece of code was (before migration to GIT)

	if (jffs2_nor_ecc(c) || jffs2_nor_wbuf_flash(c)) {
		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);
		}
	}

Your commit just was one which removed that check completely. Probably
jffs2_nor_wbuf_flash(c) check here was just missed duirng migration to
GIT and "[JFFS2] Teach JFFS2 about Sibley flash" commit is just
incomplete.

http://kernel.org/git/?p=linux/kernel/git/dwmw2/mtd-2.6.git;a=commit;h=59da721a2288b8aec751a2716f7ab60f2ea0c925

Dunno.

Anyway I was speaking _not_ about reverting part of your patch but
about getting back following code for Sibley, since it indeed shows if
we moved 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);
		}

> You must be missing something, but I don't know what.  Maybe Josh has
> some insight into this problem - he did a thorough review and asked
> many probing questions about this particular part of the patch.

It would be really nice, since current code seems to be broken somehow.

Thanks,
Alexander Belyakov




More information about the linux-mtd mailing list