public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* writing to jffs2 is so slow?
@ 2002-09-05 21:09 Xiaogeng (Shawn) Jin
  2002-09-06  7:15 ` Thomas TESTASECCA
  2002-09-06 12:08 ` Kenneth Johansson
  0 siblings, 2 replies; 10+ messages in thread
From: Xiaogeng (Shawn) Jin @ 2002-09-05 21:09 UTC (permalink / raw)
  To: linux-mtd

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: writing to jffs2 is so slow?
  2002-09-05 21:09 writing to jffs2 is so slow? Xiaogeng (Shawn) Jin
@ 2002-09-06  7:15 ` Thomas TESTASECCA
  2002-09-06 12:08 ` Kenneth Johansson
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas TESTASECCA @ 2002-09-06  7:15 UTC (permalink / raw)
  To: Xiaogeng (Shawn) Jin, linux-mtd

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 : linux-mtd-admin@lists.infradead.org
[mailto:linux-mtd-admin@lists.infradead.org]De la part de Xiaogeng
(Shawn) Jin
Envoye : jeudi 5 septembre 2002 23:10
A : linux-mtd@lists.infradead.org
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/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: writing to jffs2 is so slow?
  2002-09-05 21:09 writing to jffs2 is so slow? Xiaogeng (Shawn) Jin
  2002-09-06  7:15 ` Thomas TESTASECCA
@ 2002-09-06 12:08 ` Kenneth Johansson
  2002-09-06 17:14   ` Xiaogeng (Shawn) Jin
  1 sibling, 1 reply; 10+ messages in thread
From: Kenneth Johansson @ 2002-09-06 12:08 UTC (permalink / raw)
  To: Xiaogeng (Shawn) Jin; +Cc: Mtd

On Thu, 2002-09-05 at 23:09, Xiaogeng (Shawn) Jin wrote:
> 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.


-- 
Kenneth Johansson	
Ericsson AB                       Tel: +46 8 404 71 83
Borgafjordsgatan 9                Fax: +46 8 404 72 72
164 80 Stockholm                  kenneth.johansson@etx.ericsson.se

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: writing to jffs2 is so slow?
  2002-09-06 12:08 ` Kenneth Johansson
@ 2002-09-06 17:14   ` Xiaogeng (Shawn) Jin
  2002-09-06 17:48     ` Jörn Engel
  0 siblings, 1 reply; 10+ messages in thread
From: Xiaogeng (Shawn) Jin @ 2002-09-06 17:14 UTC (permalink / raw)
  To: Kenneth Johansson; +Cc: Mtd

> 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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: writing to jffs2 is so slow?
  2002-09-06 17:14   ` Xiaogeng (Shawn) Jin
@ 2002-09-06 17:48     ` Jörn Engel
  2002-09-06 18:32       ` Xiaogeng (Shawn) Jin
  0 siblings, 1 reply; 10+ messages in thread
From: Jörn Engel @ 2002-09-06 17:48 UTC (permalink / raw)
  To: Xiaogeng (Shawn) Jin; +Cc: Kenneth Johansson, Mtd

On Fri, 6 September 2002 10:14:24 -0700, Xiaogeng (Shawn) Jin wrote:
> >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

-- 
Beware of bugs in the above code; I have only proved it correct, but
not tried it.
-- Donald Knuth

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: writing to jffs2 is so slow?
  2002-09-06 17:48     ` Jörn Engel
@ 2002-09-06 18:32       ` Xiaogeng (Shawn) Jin
  2002-09-06 18:54         ` David Woodhouse
  2002-09-06 18:57         ` Jörn Engel
  0 siblings, 2 replies; 10+ messages in thread
From: Xiaogeng (Shawn) Jin @ 2002-09-06 18:32 UTC (permalink / raw)
  To: Jörn Engel; +Cc: Kenneth Johansson, Mtd

>>>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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: writing to jffs2 is so slow?
  2002-09-06 18:32       ` Xiaogeng (Shawn) Jin
@ 2002-09-06 18:54         ` David Woodhouse
  2002-09-06 21:20           ` Joakim Tjernlund
  2002-09-06 18:57         ` Jörn Engel
  1 sibling, 1 reply; 10+ messages in thread
From: David Woodhouse @ 2002-09-06 18:54 UTC (permalink / raw)
  To: Xiaogeng (Shawn) Jin; +Cc: Jörn Engel, Kenneth Johansson, Mtd

xjin@redswitch.com said:
> > 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.

> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: writing to jffs2 is so slow?
  2002-09-06 18:32       ` Xiaogeng (Shawn) Jin
  2002-09-06 18:54         ` David Woodhouse
@ 2002-09-06 18:57         ` Jörn Engel
  1 sibling, 0 replies; 10+ messages in thread
From: Jörn Engel @ 2002-09-06 18:57 UTC (permalink / raw)
  To: Xiaogeng (Shawn) Jin; +Cc: Kenneth Johansson, Mtd

On Fri, 6 September 2002 11:32:01 -0700, Xiaogeng (Shawn) Jin wrote:
> >
> >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

-- 
Victory in war is not repetitious.
-- Sun Tzu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: writing to jffs2 is so slow?
  2002-09-06 18:54         ` David Woodhouse
@ 2002-09-06 21:20           ` Joakim Tjernlund
  2002-09-06 21:30             ` David Woodhouse
  0 siblings, 1 reply; 10+ messages in thread
From: Joakim Tjernlund @ 2002-09-06 21:20 UTC (permalink / raw)
  To: David Woodhouse, Xiaogeng (Shawn) Jin
  Cc: Jörn Engel, Kenneth Johansson, Mtd

----- Original Message -----
From: "David Woodhouse" <dwmw2@infradead.org>
To: "Xiaogeng (Shawn) Jin" <xjin@redswitch.com>
Cc: "Jörn Engel" <joern@wohnheim.fh-wedel.de>; "Kenneth Johansson" <kenneth.johansson@etx.ericsson.se>; "Mtd"
<linux-mtd@lists.infradead.org>
Sent: den 6 september 2002 20:54
Subject: Re: writing to jffs2 is so slow?


>
> xjin@redswitch.com said:
> > > 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.
>
> > 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: writing to jffs2 is so slow?
  2002-09-06 21:20           ` Joakim Tjernlund
@ 2002-09-06 21:30             ` David Woodhouse
  0 siblings, 0 replies; 10+ messages in thread
From: David Woodhouse @ 2002-09-06 21:30 UTC (permalink / raw)
  To: Joakim Tjernlund
  Cc: Xiaogeng (Shawn) Jin, Jörn Engel, Kenneth Johansson, Mtd

Joakim.Tjernlund@lumentis.se 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-09-06 21:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-05 21:09 writing to jffs2 is so slow? Xiaogeng (Shawn) Jin
2002-09-06  7:15 ` Thomas TESTASECCA
2002-09-06 12:08 ` Kenneth Johansson
2002-09-06 17:14   ` Xiaogeng (Shawn) Jin
2002-09-06 17:48     ` Jörn Engel
2002-09-06 18:32       ` Xiaogeng (Shawn) Jin
2002-09-06 18:54         ` David Woodhouse
2002-09-06 21:20           ` Joakim Tjernlund
2002-09-06 21:30             ` David Woodhouse
2002-09-06 18:57         ` Jörn Engel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox