public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] Speed up mount for cfi_cmdset_0001 users
@ 2007-03-27 11:44 Joakim Tjernlund
  2007-03-27 11:49 ` Joakim Tjernlund
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2007-03-27 11:44 UTC (permalink / raw)
  To: linux-mtd

This will speed up mount greatly for users of point/unpoint method
like cfi_cmdset_0001. Please Apply.

 Jocke

>From bcd1aa987ab786c526e225269775a557a1bcbe1f Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Date: Tue, 27 Mar 2007 13:32:09 +0200
Subject: [PATCH] Speed up mount for cfi_cmdset_0001 users
Remove excessive scanning of empty flash after a clean
marker for users of the point/unpoint method. cfi_cmdset_0001
uses point/unpoint by default iff flash mapping is linear.
The speedup is several orders of magnitude if FS is less than
half full.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---
 fs/jffs2/scan.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index b98661a..4679abe 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -632,16 +632,17 @@ scan_more:
 
 		if (*(uint32_t *)(&buf[ofs-buf_ofs]) == 0xffffffff) {
 			uint32_t inbuf_ofs;
-			uint32_t empty_start;
+			uint32_t empty_start, scan_end;
 
 			empty_start = ofs;
 			ofs += 4;
+			scan_end = min_t(uint32_t, EMPTY_SCAN_SIZE(c->sector_size)/8, buf_len);
 
 			D1(printk(KERN_DEBUG "Found empty flash at 0x%08x\n", ofs));
 		more_empty:
 			inbuf_ofs = ofs - buf_ofs;
-			while (inbuf_ofs < buf_len) {
-				if (*(uint32_t *)(&buf[inbuf_ofs]) != 0xffffffff) {
+			while (inbuf_ofs < scan_end) {
+				if (unlikely(*(uint32_t *)(&buf[inbuf_ofs]) != 0xffffffff)) {
 					printk(KERN_WARNING "Empty flash at 0x%08x ends at 0x%08x\n",
 					       empty_start, ofs);
 					if ((err = jffs2_scan_dirty_space(c, jeb, ofs-empty_start)))
@@ -662,7 +663,11 @@ scan_more:
 				D1(printk(KERN_DEBUG "%d bytes at start of block seems clean... assuming all clean\n", EMPTY_SCAN_SIZE(c->sector_size)));
 				return BLK_STATE_CLEANMARKER;
 			}
-
+			if (!buf_size && (scan_end != buf_len)) {/* XIP/point case */
+				scan_end = buf_len;
+				goto more_empty;
+			}
+			
 			/* See how much more there is to read in this eraseblock... */
 			buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
 			if (!buf_len) {
@@ -672,6 +677,8 @@ scan_more:
 					  empty_start));
 				break;
 			}
+			/* point never reaches here */
+			scan_end = buf_len;
 			D1(printk(KERN_DEBUG "Reading another 0x%x at 0x%08x\n", buf_len, ofs));
 			err = jffs2_fill_scan_buf(c, buf, ofs, buf_len);
 			if (err)
-- 
1.4.4.4

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

* Re: [PATCH] Speed up mount for cfi_cmdset_0001 users
  2007-03-27 11:44 [PATCH] Speed up mount for cfi_cmdset_0001 users Joakim Tjernlund
@ 2007-03-27 11:49 ` Joakim Tjernlund
  2007-03-27 11:54   ` Jörn Engel
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2007-03-27 11:49 UTC (permalink / raw)
  To: linux-mtd

On Tue, 2007-03-27 at 13:44 +0200, Joakim Tjernlund wrote:
> This will speed up mount greatly for users of point/unpoint method
> like cfi_cmdset_0001. Please Apply.
> 
>  Jocke

Some feedback from the community would not hurt either...

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

* Re: [PATCH] Speed up mount for cfi_cmdset_0001 users
  2007-03-27 11:49 ` Joakim Tjernlund
@ 2007-03-27 11:54   ` Jörn Engel
  2007-03-27 12:04     ` Josh Boyer
  2007-03-27 12:27     ` Joakim Tjernlund
  0 siblings, 2 replies; 7+ messages in thread
From: Jörn Engel @ 2007-03-27 11:54 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linux-mtd

On Tue, 27 March 2007 13:49:33 +0200, Joakim Tjernlund wrote:
> On Tue, 2007-03-27 at 13:44 +0200, Joakim Tjernlund wrote:
> > This will speed up mount greatly for users of point/unpoint method
> > like cfi_cmdset_0001. Please Apply.
> > 
> >  Jocke
> 
> Some feedback from the community would not hurt either...

JFFS2 mount time on OLPC: ~3300ms
LogFS mount time on OLPC: ~60ms

While your works seems useful, pardon me if I don't care too much about
JFFS2 anymore. ;)

Jörn

-- 
Joern's library part 3:
http://inst.eecs.berkeley.edu/~cs152/fa05/handouts/clark-test.pdf

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

* Re: [PATCH] Speed up mount for cfi_cmdset_0001 users
  2007-03-27 11:54   ` Jörn Engel
@ 2007-03-27 12:04     ` Josh Boyer
  2007-03-27 12:12       ` Jörn Engel
  2007-03-27 12:27     ` Joakim Tjernlund
  1 sibling, 1 reply; 7+ messages in thread
From: Josh Boyer @ 2007-03-27 12:04 UTC (permalink / raw)
  To: Jörn Engel; +Cc: linux-mtd, Joakim Tjernlund

On Tue, 2007-03-27 at 13:54 +0200, Jörn Engel wrote:
> On Tue, 27 March 2007 13:49:33 +0200, Joakim Tjernlund wrote:
> > On Tue, 2007-03-27 at 13:44 +0200, Joakim Tjernlund wrote:
> > > This will speed up mount greatly for users of point/unpoint method
> > > like cfi_cmdset_0001. Please Apply.
> > > 
> > >  Jocke
> > 
> > Some feedback from the community would not hurt either...
> 
> JFFS2 mount time on OLPC: ~3300ms
> LogFS mount time on OLPC: ~60ms
> 
> While your works seems useful, pardon me if I don't care too much about
> JFFS2 anymore. ;)

Then you shouldn't respond to emails asking for feedback on it.

josh

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

* Re: [PATCH] Speed up mount for cfi_cmdset_0001 users
  2007-03-27 12:04     ` Josh Boyer
@ 2007-03-27 12:12       ` Jörn Engel
  0 siblings, 0 replies; 7+ messages in thread
From: Jörn Engel @ 2007-03-27 12:12 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linux-mtd, Joakim Tjernlund

On Tue, 27 March 2007 07:04:13 -0500, Josh Boyer wrote:
> On Tue, 2007-03-27 at 13:54 +0200, Jörn Engel wrote:
> > 
> > While your works seems useful, pardon me if I don't care too much about
> > JFFS2 anymore. ;)
> 
> Then you shouldn't respond to emails asking for feedback on it.

Unless Joakim is interested in an alternative to his work.  I don't know
whether LogFS could be useful to his current or any future projects.

Take a look at logfs.org/logfs/patches and decide for yourself.  Mount
time has been a non-issue for a long time.  Other problems still exist.
If you want something production-ready now, keep using JFFS2.

Jörn

-- 
"Security vulnerabilities are here to stay."
-- Scott Culp, Manager of the Microsoft Security Response Center, 2001

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

* Re: [PATCH] Speed up mount for cfi_cmdset_0001 users
  2007-03-27 11:54   ` Jörn Engel
  2007-03-27 12:04     ` Josh Boyer
@ 2007-03-27 12:27     ` Joakim Tjernlund
  2007-03-27 12:41       ` Jörn Engel
  1 sibling, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2007-03-27 12:27 UTC (permalink / raw)
  To: Jörn Engel; +Cc: linux-mtd

On Tue, 2007-03-27 at 13:54 +0200, Jörn Engel wrote:
> On Tue, 27 March 2007 13:49:33 +0200, Joakim Tjernlund wrote:
> > On Tue, 2007-03-27 at 13:44 +0200, Joakim Tjernlund wrote:
> > > This will speed up mount greatly for users of point/unpoint method
> > > like cfi_cmdset_0001. Please Apply.
> > > 
> > >  Jocke
> > 
> > Some feedback from the community would not hurt either...
> 
> JFFS2 mount time on OLPC: ~3300ms

What was the mount time before you applied the patch?

> LogFS mount time on OLPC: ~60ms
> 
> While your works seems useful, pardon me if I don't care too much about
> JFFS2 anymore. ;)

:) Keep working, hopefully you can do a better GC as well.
Since I only do production system ATM, it will be some time
before I will use LogFS. Does logFS do NAND as well?

 Jocke

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

* Re: [PATCH] Speed up mount for cfi_cmdset_0001 users
  2007-03-27 12:27     ` Joakim Tjernlund
@ 2007-03-27 12:41       ` Jörn Engel
  0 siblings, 0 replies; 7+ messages in thread
From: Jörn Engel @ 2007-03-27 12:41 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linux-mtd

On Tue, 27 March 2007 14:27:52 +0200, Joakim Tjernlund wrote:
> On Tue, 2007-03-27 at 13:54 +0200, Jörn Engel wrote:
> > 
> > JFFS2 mount time on OLPC: ~3300ms
> 
> What was the mount time before you applied the patch?

That was in January with the standard OLPC image.  Filesystem contained
the complete rootfs.  I did not optimize anything.

> > LogFS mount time on OLPC: ~60ms
> > 
> > While your works seems useful, pardon me if I don't care too much about
> > JFFS2 anymore. ;)
> 
> :) Keep working, hopefully you can do a better GC as well.
> Since I only do production system ATM, it will be some time
> before I will use LogFS. Does logFS do NAND as well?

In principle.  Mkfs will create a bad block map.  But any blocks
going bad later on remain unhandled.  Write or erase errors simply cause
BUG().

Not there yet, but getting closer.

Jörn

-- 
The strong give up and move away, while the weak give up and stay.
-- unknown

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

end of thread, other threads:[~2007-03-27 12:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-27 11:44 [PATCH] Speed up mount for cfi_cmdset_0001 users Joakim Tjernlund
2007-03-27 11:49 ` Joakim Tjernlund
2007-03-27 11:54   ` Jörn Engel
2007-03-27 12:04     ` Josh Boyer
2007-03-27 12:12       ` Jörn Engel
2007-03-27 12:27     ` Joakim Tjernlund
2007-03-27 12:41       ` 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