Skip to contentSkip to conversation

JFFS2 mount time

DISCUSSION Jarkko Lavinen (NMP/Helsinki) 8 participants 19 messages Jan 13, 2004 – Jan 11, 2005 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

I am working with an embedded device with 64MB nand chip. I am able to read from chip at 6MB/s and able to read the whole chip in 10 seconds using character mtd device. The device has Omap1610 running at 190MHz, kernel 2.4.21.

With 80% file system usage the mount time is 8 seconds which is unacceptable for root file system on a handheld device. I assume the scan time is linear with respect to the size of the flash partition and the file system usage.

Is there anything that could be done to reduce the mount time of large JFFS2 partitions? Lazy mounting with prioritized scanning?

Jarkko Lavinen

#1 lore raw
Quoted 5 lines

I am working with an embedded device with 64MB nand chip. I am able to read from chip at 6MB/s and able to read the whole chip in 10 seconds using character mtd device. The device has Omap1610 running at 190MHz, kernel 2.4.21.

Quoted 7 lines

With 80% file system usage the mount time is 8 seconds which is unacceptable for root file system on a handheld device. I assume the scan time is linear with respect to the size of the flash partition and the file system usage.

Is there anything that could be done to reduce the mount time of large JFFS2 partitions? Lazy mounting with prioritized scanning?

Yes, it is already done in JFFS2 CVS. Mount time for me is about a second on a 64MB JFFS2 NOR flash.

Jocke

#2 lore raw
In reply to Jarkko Lavinen (NMP/Helsinki)
Quoted 2 lines · Jarkko Lavinen (NMP/Helsinki)

Is there anything that could be done to reduce the mount time of large JFFS2 partitions? Lazy mounting with prioritized scanning?

We improved it a lot by not checking CRC32 on all nodes until later -- but we still need to read the whole medium at mount time.

We _can_ fix that. There's a limited amount of knowledge we're gaining from our scan at mount time. For each inode on the medium, we need:
Its nlink
A list of the physical addresses of all its nodes

We currently read the whole of every eraseblock to work this out. However, we could write a block 'tailer' at the _end_ of each eraseblock as we fill it, containing enough information in compressed form about the contents of the eraseblock.

That would mean that we only have to read a small proportion of each properly-finished eraseblock, and should speed up the mount significantly.

Signature · 1 line
dwmw2
#3 lore raw
Quoted 12 lines · David Woodhouse
Quoted 2 lines · Jarkko Lavinen (NMP/Helsinki)

Is there anything that could be done to reduce the mount time of large JFFS2 partitions? Lazy mounting with prioritized scanning?

We improved it a lot by not checking CRC32 on all nodes until later -- but we still need to read the whole medium at mount time.

We _can_ fix that. There's a limited amount of knowledge we're gaining from our scan at mount time. For each inode on the medium, we need:
Its nlink
A list of the physical addresses of all its nodes

Quoted 8 lines

We currently read the whole of every eraseblock to work this out. However, we could write a block 'tailer' at the _end_ of each eraseblock as we fill it, containing enough information in compressed form about the contents of the eraseblock.

That would mean that we only have to read a small proportion of each properly-finished eraseblock, and should speed up the mount significantly.

I have done some work on the JFFS2 code in u-boot and found that the fastest way was to load the entire FLASH into a continuous disk image in DRAM and then have code that directly dereference pointers into this image without any access functions or read on demand.

When I tried to be smart and skip the copy and only read in what needed to be read that was significantly slower.

Never underestimate brute force :)

If you have very very poor bandwidth from the flash the the reverse is true but I had to slow down my flash 10 times to break even.

#4 lore raw
Quoted 4 lines · Kenneth Johansson

I have done some work on the JFFS2 code in u-boot and found that the fastest way was to load the entire FLASH into a continuous disk image in DRAM and then have code that directly dereference pointers into this image without any access functions or read on demand.

What we do in the current JFFS2 code is similar. We directly dereference pointers into the _flash_ without access functions, rather than copying it into DRAM first.

Quoted 2 lines

When I tried to be smart and skip the copy and only read in what needed to be read that was significantly slower.

Bear in mind that the question was about NAND flash though -- it's not directly deferenceable, and you're not going to get the same results.

Signature · 1 line
dwmw2
#5 lore raw
Quoted 5 lines · David Woodhouse
Quoted 2 lines

When I tried to be smart and skip the copy and only read in what needed to be read that was significantly slower.

Bear in mind that the question was about NAND flash though -- it's not directly deferenceable, and you're not going to get the same results.

hmm I reread the firt post why is read so slow?? When I thought about using nand I read that reading a byte took something like 50 ns. That is like 20MB per second for an 8 bit device. This is in the region where it did not pay to be smart,the accesses overhead to do read only what's needed is greater than the time wasted reading uneccessary data.

#6 lore raw
Quoted 6 lines · Kenneth Johansson

hmm I reread the firt post why is read so slow?? When I thought about using nand I read that reading a byte took something like 50 ns. That is like 20MB per second for an 8 bit device. This is in the region where it did not pay to be smart,the accesses overhead to do read only what's needed is greater than the time wasted reading uneccessary data.

But on nand it is not only possible, but also likely that flash size is greater than ram size. Does your approach still work then?

Jörn

Signature · 4 lines
To announce that there must be no criticism of the President, or that we
are to stand by the President, right or wrong, is not only unpatriotic
and servile, but is morally treasonable to the American public.
-- Theodore Roosevelt, Kansas City Star, 1918
#7 lore raw
Quoted 8 lines · Jörn Engel
Quoted 6 lines · Kenneth Johansson

hmm I reread the firt post why is read so slow?? When I thought about using nand I read that reading a byte took something like 50 ns. That is like 20MB per second for an 8 bit device. This is in the region where it did not pay to be smart,the accesses overhead to do read only what's needed is greater than the time wasted reading uneccessary data.

Quoted 4 lines

But on nand it is not only possible, but also likely that flash size is greater than ram size. Does your approach still work then?

Jörn

Obviously no. But maybe it's still cheaper to do the work in big chunks I don't know you need to actually do a test to see what happens. It's not so easy to see in advance what will happen. I thought for sure that it would be faster to only read what was needed but it was not, at least not on a 200 MHz ppc if you have an P4 3GHz the picture is quite different.

#8 lore raw
Quoted 10 lines · Kenneth Johansson
Quoted 3 lines

But on nand it is not only possible, but also likely that flash size is greater than ram size. Does your approach still work then?

Obviously no. But maybe it's still cheaper to do the work in big chunks I don't know you need to actually do a test to see what happens. It's not so easy to see in advance what will happen. I thought for sure that it would be faster to only read what was needed but it was not, at least not on a 200 MHz ppc if you have an P4 3GHz the picture is quite different.

Could be, at least. As long as we don't know where the time is lost, everything else remains guesswork.

Anyway, David's approach sounds quite sane to me.

Jörn

Signature · 2 lines
A victorious army first wins and then seeks battle.
-- Sun Tzu
#9 lore raw
In reply to Jarkko Lavinen (NMP/Helsinki)

Hi,

Quoted 2 lines

Is there anything that could be done to reduce the mount time of large JFFS2 partitions? Lazy mounting with prioritized scanning?

I wonder if the current CVS head is much better (i.e. faster) in mounting a JFFS2 root fs then linux-2.6.10?

Or in other words: does it make sense to use the current CVS instead of the code in linux-2.6.10?

--
Steven

#10 lore raw

Hi

Try JFFS3 with "summaries" enabled or Ferenc Havasi's JFFS2 "summary" patch. The mount speed should be increased with it.

Note: JFFS3 development is in progress so be ready if it has bugs.

Quoted 17 lines · Steven Scholz

Hi,

Quoted 2 lines

Is there anything that could be done to reduce the mount time of large JFFS2 partitions? Lazy mounting with prioritized scanning?

I wonder if the current CVS head is much better (i.e. faster) in mounting a JFFS2 root fs then linux-2.6.10?

Or in other words: does it make sense to use the current CVS instead of the code in linux-2.6.10?

Signature · 5 lines
Steven

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Signature · 3 lines
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
#11 lore raw

Hi Steven,

Quoted 3 lines

Try JFFS3 with "summaries" enabled or Ferenc Havasi's JFFS2 "summary" patch. The mount speed should be increased with it.

Note: JFFS3 development is in progress so be ready if it has bugs.

Becauseof it, we maintain a summary patch for JFFS2. You can download the latest patch from http://www.inf.u-szeged.hu/jffs2/mount.php
(I'm updating the page now, so you may wait a little.)

Summary designed specially to speed up the mounttime, so it should help you.

Regards,
Ferenc

#12 lore raw

Hi Ferenc,

Quoted 6 lines
Quoted 1 line

Note: JFFS3 development is in progress so be ready if it has bugs.

Becauseof it, we maintain a summary patch for JFFS2. You can download the latest patch from http://www.inf.u-szeged.hu/jffs2/mount.php
(I'm updating the page now, so you may wait a little.)

Summary designed specially to speed up the mounttime, so it should help you.

Thanks a million. I'll try that. I guess I can just use your Patch on a vanilla linux-2.6.10!?

BTW: On the link mentioned above I read "Speed up the mount time of JFFS2 - specially when it uses NAND flash. " How about NOR flash?

--
Steven

#13 lore raw
Quoted 4 lines

Thanks a million. I'll try that. I guess I can just use your Patch on a vanilla linux-2.6.10!?

BTW: On the link mentioned above I read "Speed up the mount time of JFFS2 - specially when it uses NAND flash. " How about NOR flash?

My understanding of the problem is that summary may help in case of NOR, but in general it shouldn't increase the mount speed a lot (am I wrong?). If we change the patch a bit (asking not to check any CRC in the block has summary) we may have better mount speed (and iget()). And possibly in case of nor we even doesn't need to store any data in summary - only header. Header will show us that the block was successfully written (no unclean reboots) and we my trust it and do not check CRC.

Moreover, looking through the patch I suspect it wasn't tested with NOR, is it?

Signature · 3 lines
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
#14 lore raw

Hi Steven,

Quoted 6 lines
Quoted 4 lines

Thanks a million. I'll try that. I guess I can just use your Patch on a vanilla linux-2.6.10!?

BTW: On the link mentioned above I read "Speed up the mount time of JFFS2 - specially when it uses NAND flash. " How about NOR flash?

My understanding of the problem is that summary may help in case of NOR, but in general it shouldn't increase the mount speed a lot (am I wrong?).

Artem is right.

Quoted 1 line

Moreover, looking through the patch I suspect it wasn't tested with NOR, is it?

It should work with NOR, too. Now we tested it again, and noticed some problems. One of them are "general", and an other is NOR specific. We will fix it soon, so you may wait a little before testing it.

Quoted 9 lines

If we change
the patch a bit (asking not to check any CRC in the block has summary) we may
have better mount speed (and iget()). And possibly in case of nor we even doesn't
need to store any data in summary - only header. Header will show us that the block
was successfully written (no unclean reboots) and we my trust it and do not check CRC.

Yes, if everything will be stable we should start to make it more optimal.

Bye,
Ferenc

#15 lore raw
In reply to Artem B. Bityuckiy

Hi,

Quoted 6 lines
Quoted 4 lines

Thanks a million. I'll try that. I guess I can just use your Patch on a vanilla linux-2.6.10!?

BTW: On the link mentioned above I read "Speed up the mount time of JFFS2 - specially when it uses NAND flash. " How about NOR flash?

My understanding of the problem is that summary may help in case of NOR, but in general it shouldn't increase the mount speed a lot (am I wrong?).

As I wrote in another thread the summary patch reduced the mount time from 6 seconds to less than 1 second on my embedded ARM9 system with 8MB NAND flash. But now GC still slows down the start up of user applications as it checks all CRCs right after booting.

Quoted 5 lines

If we change
the patch a bit (asking not to check any CRC in the block has summary) we may have better mount speed (and iget()). And possibly in case of nor we even doesn't need to store any data in summary - only header. Header will show us that the block was successfully written (no unclean reboots) and we my trust it and do not check CRC.

Makes sense to me.
Ferenc, what do you think about that?
No need to check CRC if we have a summary, right? This could fix my GC problem mentioned above and in the thread
http://lists.infradead.org/pipermail/linux-mtd/2005-January/011411.html

--
Steven

#16 lore raw
Quoted 1 line · Steven Scholz

As I wrote in another thread the summary patch reduced the mount time from 6 seconds to less than 1 second on my embedded ARM9 system with 8MB NAND flash.

Of course I meant the good old NOR flash.

--
Steven

#17 lore raw
In reply to Steven Scholz

Hi Steven,

Quoted 8 lines

As I wrote in another thread the summary patch reduced the mount time from 6 seconds to less than 1 second on my embedded ARM9 system with 8MB NAND flash. But now GC still slows down the start up of user applications as it checks all CRCs right after booting.

Quoted 5 lines

If we change
the patch a bit (asking not to check any CRC in the block has summary) we may have better mount speed (and iget()). And possibly in case of nor we even doesn't need to store any data in summary - only header. Header will show us that the block was successfully written (no unclean reboots) and we my trust it and do not check CRC.

If I am right CRCs are not only against the effect of unclean reboots but also to handle flash errors. On NAND flashes the ECC handles this problem but NOR doesn't have any error detection system.

Quoted 2 lines

Ferenc, what do you think about that?
No need to check CRC if we have a summary, right?

Give us some days to invetigate it more deeply. I think we will be able to imrove the summary patch in some way.

Bye,
Ferenc

#18 lore raw

Hi Ferenc,

Quoted 6 lines

If I am right CRCs are not only against the effect of unclean reboots but also to handle flash errors. On NAND flashes the ECC handles this problem but NOR doesn't have any error detection system.

Quoted 2 lines

Ferenc, what do you think about that?
No need to check CRC if we have a summary, right?

Give us some days to invetigate it more deeply. I think we will be able to imrove the summary patch in some way.

I now get

Eep. Child "libutil.so" (ino #230) of dir ino #5 doesn't exist! Eep. Child "libthread_db.so" (ino #227) of dir ino #5 doesn't exist! Eep. Child "libutil.so.1" (ino #231) of dir ino #5 doesn't exist! Eep. Child "libthread_db-1.0.so" (ino #226) of dir ino #5 doesn't exist! Eep. Child "libutil-2.3.3.so" (ino #229) of dir ino #5 doesn't exist! Eep. Child "libthread_db.so.1" (ino #228) of dir ino #5 doesn't exist! Eep. Child "adjtimex" (ino #237) of dir ino #9 doesn't exist! Eep. Child "backlight" (ino #238) of dir ino #9 doesn't exist! Eep. Child "log" (ino #299) of dir ino #13 doesn't exist!
Eep. Child "demo_320_240_16.xml" (ino #234) of dir ino #232 doesn't exist! Eep. Child "demo.xml" (ino #233) of dir ino #232 doesn't exist! Eep. Child "fonttest" (ino #235) of dir ino #232 doesn't exist!
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 72K

while booting! :-(

I am not sure if this has to do with the summary patch. How can I find out?

--
Steven