This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Disable JFFS2 compression


The patch below adds a cdl option to disable compression for
jffs2. Compression uses a lot of ram and is rather slow on
low-end embedded CPUs (as the AT91, for example). David, is
this o.k. with you?

tk



diff -ru packages-orig/fs/jffs2/current/ChangeLog packages/fs/jffs2/current/ChangeLog
--- packages-orig/fs/jffs2/current/ChangeLog	2003-10-16 14:25:18.000000000 +0200
+++ packages/fs/jffs2/current/ChangeLog	2003-11-12 19:09:38.000000000 +0100
@@ -1,3 +1,8 @@
+2003-11-12  Thomas Koeller  <thomas.koeller@baslerweb.com>
+	* cdl/jffs2.cdl:
+	* src/nodelist.h: Added CYGPKG_FS_JFFS2_COMPRESS to
+	disable compression.
+
 2003-10-14  Thomas Koeller  <thomas.koeller@baslerweb.com>
 
 	* src/os-ecos.h: Made definition of CONFIG_JFFS2_FS_DEBUG
diff -ru packages-orig/fs/jffs2/current/cdl/jffs2.cdl packages/fs/jffs2/current/cdl/jffs2.cdl
--- packages-orig/fs/jffs2/current/cdl/jffs2.cdl	2003-10-16 14:25:18.000000000 +0200
+++ packages/fs/jffs2/current/cdl/jffs2.cdl	2003-11-12 18:19:18.000000000 +0100
@@ -45,6 +45,7 @@
 # Author(s):      David Woodhouse, Dominic Ostrowski
 # Original data:  ported from JFFS2 by David Woodhouse
 # Contributors:   dominic.ostrowski@3glab.com
+#                 tkoeller <thomas.koeller@baslerweb.com>
 # Date:           2000-08-28
 #
 #####DESCRIPTIONEND####
@@ -75,6 +76,19 @@
     compile        -library=libextras.a fs-ecos.c
     compile        build.c scan.c malloc-ecos.c nodelist.c nodemgmt.c readinode.c erase.c dir-ecos.c write.c gc.c read.c compr.c compr_zlib.c compr_rtime.c compr_rubin.c file-ecos.c
 
+    cdl_option CYGPKG_FS_JFFS2_COMPRESS {
+        display         "Compress data"
+        flavor          bool
+        default_value   1
+        description     "
+            Use the ZLIB package and store data in compressed form.
+            Compression and decompression are entirely handled by the file
+            system and are fully transparent to applications. However,
+            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 CYGPKG_FS_JFFS2_CFLAGS_ADD {
 	display "Additional compiler flags"
 	flavor  data
diff -ru packages-orig/fs/jffs2/current/src/nodelist.h packages/fs/jffs2/current/src/nodelist.h
--- packages-orig/fs/jffs2/current/src/nodelist.h	2003-08-05 17:25:26.000000000 +0200
+++ packages/fs/jffs2/current/src/nodelist.h	2003-11-12 18:44:20.000000000 +0100
@@ -23,6 +23,7 @@
 
 #ifdef __ECOS
 #include "os-ecos.h"
+#include <pkgconf/fs_jffs2.h>
 #else
 #include <linux/mtd/compatmac.h> /* For min/max in older kernels */
 #include "os-linux.h"
diff -ru packages-orig/fs/jffs2/current/src/write.c packages/fs/jffs2/current/src/write.c
--- packages-orig/fs/jffs2/current/src/write.c	2003-02-05 01:00:40.000000000 +0100
+++ packages/fs/jffs2/current/src/write.c	2003-11-12 18:28:04.000000000 +0100
@@ -300,6 +300,10 @@
 		datalen = writelen;
 		cdatalen = min_t(uint32_t, alloclen - sizeof(*ri), writelen);
 
+#if defined(__ECOS) && !defined(CYGPKG_FS_JFFS2_COMPRESS)
+		comprbuf = buf;
+		datalen = cdatalen;
+#else
 		comprbuf = kmalloc(cdatalen, GFP_KERNEL);
 		if (comprbuf) {
 			comprtype = jffs2_compress(buf, comprbuf, &datalen, &cdatalen);
@@ -311,6 +315,7 @@
 			comprbuf = buf;
 			datalen = cdatalen;
 		}
+#endif
 		/* Now comprbuf points to the data to be written, be it compressed or not.
 		   comprtype holds the compression type, and comprtype == JFFS2_COMPR_NONE means
 		   that the comprbuf doesn't need to be kfree()d. 


--------------------------------------------------

Thomas Koeller, Software Development

Basler Vision Technologies
An der Strusbek 60-62
22926 Ahrensburg
Germany

Tel +49 (4102) 463-162
Fax +49 (4102) 463-239

mailto:thomas.koeller@baslerweb.com
http://www.baslerweb.com

==============================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]