scan.c & ACCURATE

Joakim Tjernlund Joakim.Tjernlund at lumentis.se
Tue Feb 26 08:42:48 EST 2002


Hi 

Patch 1 skips scanning of inodes and dirents which are obsoleted.  Improves
scan speed. 

Patch 2 increases INOCACHE_HASHSIZE to 14 which also make scan alot
faster.

Tested in the stable branch, but these patches
is agains latest CVS. Please add to stable branch when you think it's stable.

       jocke 

Index: fs/jffs2/scan.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/scan.c,v
retrieving revision 1.61
diff -u -u -r1.61 scan.c
--- fs/jffs2/scan.c     2002/02/21 23:50:46     1.61
+++ fs/jffs2/scan.c     2002/02/26 13:37:27
@@ -509,7 +509,12 @@
                       retlen, *ofs, sizeof(ri));
                return -EIO;
        }
-
+       if (!(ri.nodetype & JFFS2_NODE_ACCURATE)) {
+               /* Wheee. This is an obsoleted node */
+               DIRTY_SPACE(PAD(ri.totlen));
+               *ofs += PAD(ri.totlen);
+               return 0;
+       }
        /* We sort of assume that the node was accurate when it was
           first written to the medium :) */
        oldnodetype = ri.nodetype;
@@ -685,7 +690,12 @@
                       retlen, *ofs, sizeof(rd));
                return -EIO;
        }
-
+       if (!(rd.nodetype & JFFS2_NODE_ACCURATE)) {
+               /* Wheee. This is an obsoleted node */
+               DIRTY_SPACE(PAD(rd.totlen));
+               *ofs += PAD(rd.totlen);
+               return 0;
+       }
        /* We sort of assume that the node was accurate when it was
           first written to the medium :) */
        oldnodetype = rd.nodetype;




Index: include/linux/jffs2_fs_sb.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/jffs2_fs_sb.h,v
retrieving revision 1.21
diff -u -u -r1.21 jffs2_fs_sb.h
--- include/linux/jffs2_fs_sb.h 2002/02/24 18:11:35     1.21
+++ include/linux/jffs2_fs_sb.h 2002/02/26 13:39:30
@@ -9,7 +9,7 @@
 #include <asm/semaphore.h>
 #include <linux/list.h>
 
-#define INOCACHE_HASHSIZE 1
+#define INOCACHE_HASHSIZE 14
 
 #define JFFS2_SB_FLAG_RO 1
 #define JFFS2_SB_FLAG_MOUNTING 2




More information about the linux-mtd mailing list