writing to jffs2 is so slow?
Hi,
I have an empty mtd partition (capacity is 16 MB) where a jffs2 fs is mounted. The strange observation is that making a first directory on that partition takes almost 2 minutes. So far I observed this behaviour just when making the first directory and just on that particular partition. Can anyone help me to explain this? Is there anything wrong with flash memory (hardware) or MTD device driver or JFFS2? Thanks.
- Shawn.
Hi Shawn,
All i can say is that it's not normal !! :)
Try to turn off the debugging mode for mtd & jffs2 (into "make menuconfig"). good luck
tom
-----Message d'origine-----
De : [email protected] [mailto:[email protected]]De la part de Xiaogeng (Shawn) Jin
Envoye : jeudi 5 septembre 2002 23:10
A : [email protected]
Objet : writing to jffs2 is so slow?
Hi,
I have an empty mtd partition (capacity is 16 MB) where a jffs2 fs is mounted. The strange observation is that making a first directory on that partition takes almost 2 minutes. So far I observed this behaviour just when making the first directory and just on that particular partition. Can anyone help me to explain this? Is there anything wrong with flash memory (hardware) or MTD device driver or JFFS2? Thanks.
- Shawn.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 9 lines · Xiaogeng (Shawn) Jin
Hi,
I have an empty mtd partition (capacity is 16 MB) where a jffs2 fs is mounted. The strange observation is that making a first directory on that partition takes almost 2 minutes. So far I observed this behaviour just when making the first directory and just on that particular partition. Can anyone help me to explain this? Is there anything wrong with flash memory (hardware) or MTD device driver or JFFS2? Thanks.
The thing is that jffs2 seems to mark the whole disk dirty and has to re erase the whole disk before you can store anything on it. This happens only the first time. If you wait a few minutes after you do the mount you should see no delay in creating directories and files.
Maybe it's possible to do a format command that creates a disk that is empty and prevents the jffs2 code to reformat every block.
Signature · 4 lines
Kenneth Johansson Ericsson AB Tel: +46 8 404 71 83 Borgafjordsgatan 9 Fax: +46 8 404 72 72 164 80 Stockholm [email protected]
Quoted 2 lines
Maybe it's possible to do a format command that creates a disk that is empty and prevents the jffs2 code to reformat every block.
A format command? What command formats MTD devices (my flash is NOR)? Thanks.
- Shawn.
Quoted 5 lines · Xiaogeng (Shawn) Jin
Quoted 2 lines
Maybe it's possible to do a format command that creates a disk that is empty and prevents the jffs2 code to reformat every block.
A format command? What command formats MTD devices (my flash is NOR)? Thanks.
Try eraseall from the utils.
With that, jffs2 just writes the erase markers to flash, 12 bytes per erase block.
Jörn
Signature · 3 lines
Beware of bugs in the above code; I have only proved it correct, but not tried it. -- Donald Knuth
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Maybe it's possible to do a format command that creates a disk that is empty and prevents the jffs2 code to reformat every block.
A format command? What command formats MTD devices (my flash is NOR)? Thanks.
Try eraseall from the utils.
With that, jffs2 just writes the erase markers to flash, 12 bytes per erase block.
Well, that's just what I did. Then making a first directory takes 2 minutes.
- Shawn.
Quoted 3 lines · [email protected] said:
Quoted 3 lines
Try eraseall from the utils.
With that, jffs2 just writes the erase markers to flash, 12 bytes per erase block.
No, JFFS2 cannot trust that 'empty' blocks really have been properly erased, and must erase them again, writing a 'cleanmarker' node to them when the erase is complete.
Quoted 2 lines
Well, that's just what I did. Then making a first directory takes 2 minutes.
JFFS2 is busy erasing every block on the file system. You have to wait until it's done before you can write.
Hacking the 'eraseall' program so it writes a 'cleanmarker' node to the beginning of every block erased is left as an exercise for the reader.
Other possibilities include a mount time option to tell JFFS2 that it should trust the flash and not re-erase the blocks, and/or changing the jffs2_write_super()/jffs2_erase_pending_blocks() to only erase a few blocks at a time, so you only have to wait for a few blocks to be erased, not the whole flash.
--
dwmw2
----- Original Message -----
From: "David Woodhouse" <[email protected]>
To: "Xiaogeng (Shawn) Jin" <[email protected]>
Cc: "Jörn Engel" <[email protected]>; "Kenneth Johansson" <[email protected]>; "Mtd" <[email protected]>
Sent: den 6 september 2002 20:54
Subject: Re: writing to jffs2 is so slow?
Quoted 10 lines
Quoted 3 lines · [email protected] said:
Quoted 3 lines
Try eraseall from the utils.
With that, jffs2 just writes the erase markers to flash, 12 bytes per erase block.No, JFFS2 cannot trust that 'empty' blocks really have been properly erased, and must erase them again, writing a 'cleanmarker' node to them when the erase is complete.
Quoted 5 lines
Quoted 2 lines
Well, that's just what I did. Then making a first directory takes 2 minutes.
JFFS2 is busy erasing every block on the file system. You have to wait until it's done before you can write.
I think that can be fixed(or at least better). Instead of eraseing all blocks first and then write cleanmarker to those blocks, make it erase one block and write cleanmarker erase the next block and write it's cleanmarker and so on.
That way you will free up erase blocks as they become ready and you don't have to watch the use % in df slowly raise to 100% and the suddenly drop to the real usage.
Jocke
Quoted 8 lines · [email protected] said:
I think that can be fixed(or at least better). Instead of eraseing
all blocks first and then write cleanmarker to those blocks, make it erase one block and write cleanmarker erase the next block and write it's cleanmarker and so on.That way you will free up erase blocks as they become ready and you don't have to watch the use % in df slowly raise to 100% and the suddenly drop to the real usage.
Agreed.
--
dwmw2
Quoted 6 lines · Xiaogeng (Shawn) Jin
Quoted 4 lines
Try eraseall from the utils.
With that, jffs2 just writes the erase markers to flash, 12 bytes per erase block.Well, that's just what I did. Then making a first directory takes 2 minutes.
Yes, you are right, silly me.
Without the erase markers, jffs2 does not trust those blocks. They could have been deleted almost completely before a power fail. And that little almost will cause random bit changes sometime liter, which is bad.
You could maybe use mkfs.jffs2 with the -p option. Might work, but I cannot check it right now.
Alternatively, you could hack the eraseall code, looking at mkfs.jffs2 for references, to write the erase markers into the flash.
Yet another alternative, you could write the erase markers via the mtdblock device. Write one into a file, pad to erase block size, append said file multiple times to itself and write it to flash.
Jörn
Signature · 2 lines
Victory in war is not repetitious. -- Sun Tzu