* [PATCH] jffs2: Reduce excessive scan of empty blocks
@ 2010-10-07 17:09 Joakim Tjernlund
2010-10-12 8:54 ` Artem Bityutskiy
0 siblings, 1 reply; 2+ messages in thread
From: Joakim Tjernlund @ 2010-10-07 17:09 UTC (permalink / raw)
To: linux-mtd; +Cc: Joakim Tjernlund
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>
---
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 3131860..4657918 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -20,7 +20,7 @@
#include "summary.h"
#include "debug.h"
-#define DEFAULT_EMPTY_SCAN_SIZE 1024
+#define DEFAULT_EMPTY_SCAN_SIZE 256
#define noisy_printk(noise, args...) do { \
if (*(noise)) { \
@@ -435,7 +435,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
unsigned char *buf, uint32_t buf_size, struct jffs2_summary *s) {
struct jffs2_unknown_node *node;
struct jffs2_unknown_node crcnode;
- uint32_t ofs, prevofs;
+ uint32_t ofs, prevofs, max_ofs;
uint32_t hdr_crc, buf_ofs, buf_len;
int err;
int noise = 0;
@@ -550,12 +550,12 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
/* We temporarily use 'ofs' as a pointer into the buffer/jeb */
ofs = 0;
-
- /* Scan only 4KiB of 0xFF before declaring it's empty */
- while(ofs < EMPTY_SCAN_SIZE(c->sector_size) && *(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF)
+ max_ofs = EMPTY_SCAN_SIZE(c->sector_size);
+ /* Scan only EMPTY_SCAN_SIZE of 0xFF before declaring it's empty */
+ while(ofs < max_ofs && *(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF)
ofs += 4;
- if (ofs == EMPTY_SCAN_SIZE(c->sector_size)) {
+ if (ofs == max_ofs) {
#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
if (jffs2_cleanmarker_oob(c)) {
/* scan oob, take care of cleanmarker */
--
1.7.2.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] jffs2: Reduce excessive scan of empty blocks
2010-10-07 17:09 [PATCH] jffs2: Reduce excessive scan of empty blocks Joakim Tjernlund
@ 2010-10-12 8:54 ` Artem Bityutskiy
0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2010-10-12 8:54 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linux-mtd
On Thu, 2010-10-07 at 19:09 +0200, Joakim Tjernlund wrote:
> 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>
> ---
> fs/jffs2/scan.c | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
Pushed to l2-mtd-2.6.git, thanks.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-12 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-07 17:09 [PATCH] jffs2: Reduce excessive scan of empty blocks Joakim Tjernlund
2010-10-12 8:54 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).