[PATCH] scan.c

Joakim Tjernlund Joakim.Tjernlund at lumentis.se
Mon Jun 17 05:48:04 EDT 2002


Hi again 

I was sure that I sent this one long time ago, but my mind must play tricks on me.

Do not scan blocks which just contain a CLEANMARKER, it's a waste of CPU cycles.

        Jocke

Index: scan.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/scan.c,v
retrieving revision 1.76
diff -u -r1.76 scan.c
--- scan.c      20 May 2002 14:56:38 -0000      1.76
+++ scan.c      17 Jun 2002 09:42:13 -0000
@@ -364,6 +364,18 @@
                                jeb->first_node = jeb->last_node = marker_ref;

                                USED_SPACE(PAD(sizeof(struct jffs2_unknown_node)));
+
+                               err = c->mtd->read(c->mtd, ofs+sizeof(struct jffs2_unknown_node),
+                                                  sizeof(node), &retlen, (char*)&node);
+                               if (node_p->magic == JFFS2_EMPTY_BITMASK &&
+                                   node_p->nodetype == JFFS2_EMPTY_BITMASK) {
+                                       /* We need to check if the first bits
+                                           after the CLEANMARKER is empty since
+                                           older FSes does not obsolete dirty EB's
+                                       */
+                                       ofs += c->sector_size;
+                                       break;
+                               }
                        }
                        ofs += PAD(sizeof(struct jffs2_unknown_node));
                        break;




More information about the linux-mtd mailing list