[PATCH] [JFFS2] Non-contiguous write bug fix (Sibley)

Alexander Belyakov abelyako at googlemail.com
Thu May 3 05:31:35 EDT 2007


On 5/2/07, David Woodhouse <dwmw2 at infradead.org> wrote:
>
> Ah, I understand. So this should fix it?
>
> diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
> index c556e85..91d1d0f 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;
>  }
>

Yes, it helps.

Thanks,
Alexander




More information about the linux-mtd mailing list