[JFFS2] Speed up mount for directly-mapped NOR flash
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Wed Apr 18 04:59:06 EDT 2007
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=c2aecda79cd872679b9b11f9e59d797fb4c7d677
Commit: c2aecda79cd872679b9b11f9e59d797fb4c7d677
Parent: 10731f83009e2556f98ffa5c7c2cbffe66dacfb3
Author: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
AuthorDate: Tue Mar 27 13:32:09 2007 +0200
Committer: David Woodhouse <dwmw2 at infradead.org>
CommitDate: Tue Apr 17 14:07:34 2007 -0400
[JFFS2] Speed up mount for directly-mapped NOR flash
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 at transmode.se>
Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
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 a5103df..7a46a43 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -636,16 +636,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)))
@@ -666,7 +667,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) {
@@ -676,6 +681,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)
More information about the linux-mtd-cvs
mailing list