public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Ricard Wanderlof <ricard.wanderlof@axis.com>
Cc: linux newbie <linux.newbie79@gmail.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: JFFS2 - speed up while booting
Date: Tue, 05 Jan 2010 13:04:02 +0200	[thread overview]
Message-ID: <1262689442.4263.35.camel@localhost> (raw)
In-Reply-To: <Pine.LNX.4.64.1001051016020.5028@lnxricardw.se.axis.com>

On Tue, 2010-01-05 at 10:23 +0100, Ricard Wanderlof wrote:
> On Tue, 5 Jan 2010, linux newbie wrote:
> 
> > Hi,
> >
> > It is slow during every boot. Seems it is scanning for bad blocks (If
> > I enable the debug message. Usually debug is OFF).
> 
> During mount, JFFS2 will scan for cleanmarkers in the OOB area of each 
> block, indicating that the block has been erased and can be used for 
> storage. If cleanmarkers can not be found in blocks that appear to be 
> empty (= all FFh), it puts the blocks on the erase queue for subsequent 
> erasure. The erase process takes time and during erasure the flash cannot 
> be read from which can account for slow booting. However, this should only 
> happen the first time after mounting a newly flashed file system. 
> Subsequent mounts should detect the cleanmarkers, and no erase will be 
> performed. It can take a few minutes to complete the erase procedure 
> though; if you do a 'top' on your system you'll see the pdflush task at 
> the top while it is in progress, so if you reboot your system several 
> times in succession JFFS2 might not have time to complete the erase of all 
> unused blocks.
> 
> I don't know if this has been addressed recently, but the odd thing is 
> that if you for instance implement separate erase sequence for instance in 
> your flash driver, the total erase+boot time is much less than if you let 
> JFFS2 handle it via the pdflush task.
> 
> Another option is to write cleanmarkers to empty blocks while writing your 
> file system image. I don't think nandwrite has an option for that though.
> 
> But at any rate, you should only see this slowdown after first mount. 
> Subsequent mounts should find the cleanmarkers in place and no erasure 
> should be necessary. So I'm not convinced this is actually your problem.

JFFS2 mount process is split on 2 phases:

1. Scanning. Done synchronously. When finished, JFFS2 is accessible in
R/O more. Some writing is often also possible, if there is substantial
amount of free space. However, generally, the FS is R/O after this
phase.

2. Checking. Done asynchronously in context of the background thread.
During this phase JFFS2 read all nodes of all inodes and checks their
CRC. This is very CPU and I/O consuming process. In essence, this is
needed to figure out which nodes are valide/obsolete and
corrupted/correct. Before this process is done, JFFS2 does not really
know how much free space there is.

On NAND, the erasing is ultra-fast, so the first mount needs erasure
factor is not that important there.

The checking process is always done, on every mount, and it is the most
expensive one.

Some more information about JFFS2 scalability weaknesses can be found in
the UBIFS vs JFFS2 table here:

http://www.linux-mtd.infradead.org/doc/ubifs.html#L_scalability

I'm not trying to promote UBIFS (it is that scalable either because of
UBI), it is just that the table contains a good overview.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

  reply	other threads:[~2010-01-05 11:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05  0:49 JFFS2 - speed up while booting linux newbie
2010-01-05  8:06 ` Ricard Wanderlof
2010-01-05  8:13   ` linux newbie
2010-01-05  9:23     ` Ricard Wanderlof
2010-01-05 11:04       ` Artem Bityutskiy [this message]
2010-01-05 16:17       ` Darwin Rambo
2010-01-05 16:57         ` Joakim Tjernlund
2010-01-06 19:54           ` Ricard Wanderlof
2010-01-06 20:59             ` Joakim Tjernlund
     [not found]               ` <2daf59621001061316g1c12353dye941d7d0105bbed1@mail.gmail.com>
2010-01-06 21:24                 ` Joakim Tjernlund
     [not found]             ` <2daf59621001061210l5a352913u6b94a5e8570b1e7b@mail.gmail.com>
2010-01-06 21:03               ` Joakim Tjernlund
2010-01-06 22:34                 ` Jamie Lokier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1262689442.4263.35.camel@localhost \
    --to=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux.newbie79@gmail.com \
    --cc=ricard.wanderlof@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox