Skip to contentSkip to conversation

jffs2: Add a "favourlzo" compression mode to jffs2

PATCH New Richard Purdie 1 participant 1 message Jul 10, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 jffs2: Add a "favourlzo" compression mode to jffs2

Add a "favourlzo" compression mode to jffs2 which tries to optimise by size but gives lzo an advantage when comparing sizes. This means the faster lzo algorithm can be preferred when there isn't much difference in compressed size (the exact threshold can be changed).

---
 fs/Kconfig       |    7 +++++++
 fs/jffs2/compr.c |   45 ++++++++++++++++++++++++++++++++++++++++-----
 fs/jffs2/compr.h |    3 +++
 3 files changed, 50 insertions(+), 5 deletions(-)
fs/Kconfig +7 -0
index 1645dfa..328a62f 100644
@@ -1359,6 +1359,13 @@ config JFFS2_CMODE_SIZE
           Tries all compressors and chooses the one which has the smallest
           result.
 
+config JFFS2_CMODE_FAVOURLZO
+        bool "Favour LZO"
+        help
+          Tries all compressors and chooses the one which has the smallest
+          result but gives some preference to LZO (which has faster
+	  decompression) at the expense of size.
+
 endchoice
 
 config CRAMFS
fs/jffs2/compr.c +40 -5

90 lines not on this page · raw message

fs/jffs2/compr.h +3 -0
index 8c6b2af..2b66941 100644
@@ -38,6 +38,9 @@
 #define JFFS2_COMPR_MODE_NONE       0
 #define JFFS2_COMPR_MODE_PRIORITY   1
 #define JFFS2_COMPR_MODE_SIZE       2
+#define JFFS2_COMPR_MODE_FAVOURLZO  3
+
+#define FAVOUR_LZO_PERCENT 80
 
 struct jffs2_compressor {
         struct list_head list;
Signature · 1 line
1.4.4.2