jffs2 copy too long after mounting

Artem Bityutskiy dedekind1 at gmail.com
Fri Aug 24 03:53:17 EDT 2012


On Thu, 2012-08-02 at 11:04 +0800, hejianet wrote:
> hi All
> my kernel is 2.6.16
> after mounting the nand flash with jffs2 partition, the first copy operation
> for a 15M file(from jffs2 partition to jffs2 partition) take 9
> minutes,but the
> second copy operation takes 1 minutes.
> the disk usage(df result) is over 85%.
> I wonder is there any patch ported to such old kernel?

His is because how JFFS2 is designed. When the mount operation is
finished, JFFS2 does not really finish mounting. There is the background
process which keeps working - it basically reads all files in the system
and checks the CRC, which is needed to find out which nodes are new and
which are obsolete.

So what happens is that you mount JFFS2, the background thread keeps
working (see 'top' for example).

While the background thread works, you can read files. But you cannot
write - writes will be blocked. Well, it is a bit more complex - you can
write a little, but from some point your writes will be blocked until
the background thread finishes. Then the write will continue and finish.

In you case, you mount, start writing your 15MiB file, write gets
blocked, waits for the background thread, then continues write. The
background thread takes ages to finish on big partitions.

The second write is fast because you do not wait for the background
thread any longer.

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120824/05e3bfb4/attachment-0001.sig>


More information about the linux-mtd mailing list