[ECOS] Problems with new JFFS2 compress infrastructure

Andrew Lunn andrew@lunn.ch
Sun Sep 19 14:27:00 GMT 2004


On Thu, Sep 16, 2004 at 02:09:59PM +0000, eibach@gdsys.de wrote:
> Hi,
> 
> > > Am I missing something obvious or is the cdl simply outdated?
> > 
> > I think this is the case - there were some changes in this
> > area in the JFFS2 code recently and it looks like they weren't
> > reflected into the CDL.
> > 
> > Perhaps you can figure out the changes and send a patch?
> 
> I've attached the patch. Works fine for me.

There was one new option you missed which i have added.

        Andrew
-------------- next part --------------
Index: fs/jffs2/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/ChangeLog,v
retrieving revision 1.36
diff -u -r1.36 ChangeLog
--- fs/jffs2/current/ChangeLog	13 Aug 2004 10:55:27 -0000	1.36
+++ fs/jffs2/current/ChangeLog	19 Sep 2004 14:25:24 -0000
@@ -1,3 +1,10 @@
+2004-09-16  Dirk Eibach  <eibach@gdsys.de>
+2004-09-19  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* cdl/jffs2.cdl: Fixed outdated definitions for compression options.
+	* src/fs-ecos.c: Added missing calls for jffs2_compressors_init()
+        and jffs2_compressors_exit() 
+
 2004-08-13  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/compr.h: Committed this file which if forgot yesterday.
Index: fs/jffs2/current/cdl/jffs2.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/cdl/jffs2.cdl,v
retrieving revision 1.17
diff -u -r1.17 jffs2.cdl
--- fs/jffs2/current/cdl/jffs2.cdl	12 Aug 2004 21:35:27 -0000	1.17
+++ fs/jffs2/current/cdl/jffs2.cdl	19 Sep 2004 14:25:24 -0000
@@ -119,7 +119,7 @@
             fairly verbose output. Level 2 is insanely loquacious."
     }
 
-    cdl_option CYGOPT_FS_JFFS2_COMPRESS {
+    cdl_component CYGOPT_FS_JFFS2_COMPRESS {
         display         "Compress data"
         flavor          bool
         define          JFFS2_COMPRESSION
@@ -130,47 +130,56 @@
             selecting this option increases the amount of RAM required and
             slows down read and write operations considerably if you have a
             slow CPU."
-    }
 
-    cdl_option CYGOPT_FS_JFFS2_COMPRESS_ZLIB {
-        display         "Compress data using zlib"
-        flavor          bool
-        define          JFFS2_USE_ZLIB
-        requires        CYGPKG_COMPRESS_ZLIB
-        requires        CYGOPT_FS_JFFS2_COMPRESS
-        compile         compr_zlib.c
-        default_value   1
-        description     "
-            Use zlib for compression of data. This is the slowest of the
-            compression options available but the most effective."
-    }
+        cdl_option CYGOPT_FS_JFFS2_COMPRESS_ZLIB {
+            display         "Compress data using zlib"
+            flavor          bool
+            define          CONFIG_JFFS2_ZLIB
+            requires        CYGPKG_COMPRESS_ZLIB
+            compile         compr_zlib.c
+            default_value   1
+            description     "
+                Use zlib for compression of data. This is the slowest of the
+                compression options available but the most effective."
+        }
 
-    cdl_option CYGOPT_FS_JFFS2_COMPRESS_RTIME {
-        display         "Compress data using rtime"
-        flavor          bool
-        define          JFFS2_USE_RTIME
-        requires        CYGOPT_FS_JFFS2_COMPRESS
-        compile         compr_rtime.c
-        default_value   1
-        description     "
-            Use the rtime algorithm for compression of data. This 
-            simple algorithm often manages to squeeze and extra few
-            bytes from data already compressed with gzip."
-    }
+        cdl_option CYGOPT_FS_JFFS2_COMPRESS_RTIME {
+            display         "Compress data using rtime"
+            flavor          bool
+            define          CONFIG_JFFS2_RTIME
+            compile         compr_rtime.c
+            default_value   1
+            description     "
+                Use the rtime algorithm for compression of data. This 
+                simple algorithm often manages to squeeze and extra few
+                bytes from data already compressed with gzip."
+        }
 
-    cdl_option CYGOPT_FS_JFFS2_COMPRESS_RUBIN {
-        display         "Compress data using rubin"
-        flavor          bool
-        define          JFFS2_USE_RTIME
-        requires        CYGOPT_FS_JFFS2_COMPRESS
-        compile         compr_rubin.c
-        default_value   !CYGOPT_FS_JFFS2_COMPRESS_ZLIB
-        description     "
-            Use the rubin algorithm for compression of data. This 
-            simple algorithm is faster than zlib but not quite as
-            effective."
+        cdl_option CYGOPT_FS_JFFS2_COMPRESS_RUBIN {
+            display         "Compress data using rubin"
+            flavor          bool
+            define          CONFIG_JFFS2_RUBIN
+            requires        CYGOPT_FS_JFFS2_COMPRESS
+            compile         compr_rubin.c
+            description     "
+                Use the rubin algorithm for compression of data. This 
+                simple algorithm is faster than zlib but not quite as
+                effective."
+        }
+        cdl_option CYGOPT_FS_JFFS2_COMPRESS_CMODE {
+            display         "Set the default compression mode"
+            flavor          data
+            default_value   { "PRIORITY" }
+            legal_values    { "NONE" "PRIORITY" "SIZE" }
+            define          CONFIG_JFFS2_CMODE
+            description     "
+                You can set here the default compression mode of JFFS2 from 
+                the avaiable compression modes. NONE causes no compression to
+                be performed. PRIORITY tries the compressors in a predefined
+                order and chooses the first successfull one. SIZE tries all 
+                compressors and chooses the one which has the smallest result"
+        }
     }
-
     cdl_option CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE {
         display         "Memory pool size"
         flavor          data
Index: fs/jffs2/current/src/fs-ecos.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/src/fs-ecos.c,v
retrieving revision 1.28
diff -u -r1.28 fs-ecos.c
--- fs/jffs2/current/src/fs-ecos.c	12 Aug 2004 21:35:28 -0000	1.28
+++ fs/jffs2/current/src/fs-ecos.c	19 Sep 2004 14:25:26 -0000
@@ -21,6 +21,7 @@
 #include <linux/pagemap.h>
 #include <linux/crc32.h>
 #include "nodelist.h"
+#include "compr.h"
 
 #include <errno.h>
 #include <string.h>
@@ -543,14 +544,18 @@
 			return ENOMEM;
 		}
 		memset(c->inocache_list, 0, sizeof(struct jffs2_inode_cache *) * INOCACHE_HASHSIZE);
-                if (n_fs_mounted++ == 0)
+                if (n_fs_mounted++ == 0) {
                         jffs2_create_slab_caches(); // No error check, cannot fail
+			jffs2_compressors_init(); 
+		}
 
 		err = jffs2_read_super(jffs2_sb);
 
 		if (err) {
-                        if (--n_fs_mounted == 0)
+                        if (--n_fs_mounted == 0) {
                                 jffs2_destroy_slab_caches();
+				jffs2_compressors_exit();
+			}
                         
 			free(jffs2_sb);
 			free(c->inocache_list);
@@ -662,8 +667,10 @@
 	} else {
 		jffs2_sb->s_mount_count--;
         }
-        if (--n_fs_mounted == 0)
+        if (--n_fs_mounted == 0) {
                 jffs2_destroy_slab_caches();        
+		jffs2_compressors_exit();
+	}
 	return ENOERR;
 }
 

-------------- next part --------------
-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


More information about the Ecos-discuss mailing list