data loss on jffs2 filesystem on dataflash

Artem B. Bityutskiy dedekind at infradead.org
Thu Sep 22 08:44:19 EDT 2005


On Thu, 2005-09-22 at 14:30 +0200, Peter Menzebach wrote:
> OK guys,
> here we are with a patch for it. I made several tests now with
> wbuf->pagesize of 1056 and 8*1056 and erase size of 8*1056 and it looks
> good so far.
> 
> Open is now the question, if we should implement a possibility to adjust
> the wbuf_pagesize independently from the jffs2 sectorsize. For my
> purposes I can live with a wbuf_size = jffs2 sector_size = 8*1056, but
> if we find a nice solution, I would implement it...
You can leave. But do you want to have more CPU load, more Flash IO,
faster flash wear, more lost data after Unclean reboot?

If no, make wbuf_size = DataFlash page size. And IMO, it is *MUST* for
CVS commit.

> IMHO the cleanest solution would be, that the dataflash/mtd layer
> reports it's true erase_size = smallest write size = 528/1056 bytes, and
> should not make a further guess about later use.
I thinks the cleanest if it reports *both* sizes. Let the upper (above
MTD) layers decide what erasesize to use.

> P.S. Sry I can't manage to send the patch as attachment. (it get's 
> rejected by the mailing list)
That's usual thing, unfortunately.


> -#ifndef CONFIG_JFFS2_FS_WRITEBUFFER
> +/*
>   #define SECTOR_ADDR(x) ( ((unsigned long)(x) & ~(c->sector_size-1)) )
> +*/
What for this comment ?

>   	struct kvec outvecs[3];
> @@ -654,7 +645,7 @@
>   	   erase block. Anything else, and you die.
>   	   New block starts at xxx000c (0-b = block header)
>   	*/
> -	if (SECTOR_ADDR(to) != SECTOR_ADDR(c->wbuf_ofs)) {
> +	if (PAGE_DIV(to) != PAGE_DIV(c->wbuf_ofs)) {
Why this change ?

>   	if (!c->mtd->block_markbad)
> -		return 1; // What else can we do?
> +		return 1;
Why this change ?

> 
>   	D1(printk(KERN_WARNING "jffs2_write_nand_badblock(): Marking bad 
> block at %08x\n", bad_offset));
>   	ret = c->mtd->block_markbad(c->mtd, bad_offset);
> diff -urN mtda/drivers/mtd/mtdpart.c mtdb/drivers/mtd/mtdpart.c
> --- mtda/drivers/mtd/mtdpart.c	2005-02-08 18:11:13.000000000 +0100
> +++ mtdb/drivers/mtd/mtdpart.c	2005-09-14 13:20:18.000000000 +0200
> @@ -465,8 +465,9 @@
I think this is better to send as a distinct patch.

-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.





More information about the linux-mtd mailing list