diff options
author | Joakim Tjernlund <Joakim.Tjernlund@transmode.se> | 2010-10-07 13:09:34 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-10-24 20:12:20 -0400 |
commit | 41bdc602eca8738d6f3c71235744f72d888fe6b4 (patch) | |
tree | 93a747b3a9cab9fec548fef795d6fa4102b11558 /fs/jffs2/scan.c | |
parent | 81cfc9f1f4ad8d335367bb393bd042cc45b00047 (diff) |
jffs2: Reduce excessive scan of empty blocks
Scanning 1024 bytes to see if an EB is empty is a bit much.
Lower it to 256 bytes and make sure the while loop is
optimized.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'fs/jffs2/scan.c')
-rw-r--r-- | fs/jffs2/scan.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 46f870d1cc36..b632dddcb482 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include "summary.h" | 20 | #include "summary.h" |
21 | #include "debug.h" | 21 | #include "debug.h" |
22 | 22 | ||
23 | #define DEFAULT_EMPTY_SCAN_SIZE 1024 | 23 | #define DEFAULT_EMPTY_SCAN_SIZE 256 |
24 | 24 | ||
25 | #define noisy_printk(noise, args...) do { \ | 25 | #define noisy_printk(noise, args...) do { \ |
26 | if (*(noise)) { \ | 26 | if (*(noise)) { \ |
@@ -435,7 +435,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo | |||
435 | unsigned char *buf, uint32_t buf_size, struct jffs2_summary *s) { | 435 | unsigned char *buf, uint32_t buf_size, struct jffs2_summary *s) { |
436 | struct jffs2_unknown_node *node; | 436 | struct jffs2_unknown_node *node; |
437 | struct jffs2_unknown_node crcnode; | 437 | struct jffs2_unknown_node crcnode; |
438 | uint32_t ofs, prevofs; | 438 | uint32_t ofs, prevofs, max_ofs; |
439 | uint32_t hdr_crc, buf_ofs, buf_len; | 439 | uint32_t hdr_crc, buf_ofs, buf_len; |
440 | int err; | 440 | int err; |
441 | int noise = 0; | 441 | int noise = 0; |
@@ -550,12 +550,12 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo | |||
550 | 550 | ||
551 | /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ | 551 | /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ |
552 | ofs = 0; | 552 | ofs = 0; |
553 | 553 | max_ofs = EMPTY_SCAN_SIZE(c->sector_size); | |
554 | /* Scan only 4KiB of 0xFF before declaring it's empty */ | 554 | /* Scan only EMPTY_SCAN_SIZE of 0xFF before declaring it's empty */ |
555 | while(ofs < EMPTY_SCAN_SIZE(c->sector_size) && *(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF) | 555 | while(ofs < max_ofs && *(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF) |
556 | ofs += 4; | 556 | ofs += 4; |
557 | 557 | ||
558 | if (ofs == EMPTY_SCAN_SIZE(c->sector_size)) { | 558 | if (ofs == max_ofs) { |
559 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER | 559 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER |
560 | if (jffs2_cleanmarker_oob(c)) { | 560 | if (jffs2_cleanmarker_oob(c)) { |
561 | /* scan oob, take care of cleanmarker */ | 561 | /* scan oob, take care of cleanmarker */ |