Skip to contentSkip to conversation

jffs2: Add LZO compression support to jffs2

PATCH In review Richard Purdie 3 participants 4 messages May 4, 2007

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

PATCH 2/5 jffs2: Add LZO compression support to jffs2

Add LZO1X compression/decompression support to jffs2.

LZO's interface doesn't entirely match that required by jffs2 so a buffer and memcpy is unavoidable.

---
 fs/Kconfig            |   11 +++++
 fs/jffs2/Makefile     |    1 +
 fs/jffs2/compr.c      |    6 +++
 fs/jffs2/compr.h      |    7 +++-
 fs/jffs2/compr_lzo.c  |  110 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/jffs2.h |    1 +
 6 files changed, 135 insertions(+), 1 deletions(-)
fs/Kconfig +11 -0
index a42f767..421c821 100644
@@ -1310,6 +1310,17 @@ config JFFS2_ZLIB
 
           Say 'Y' if unsure.
 
+config JFFS2_LZO
+	bool "JFFS2 LZO compression support" if JFFS2_COMPRESSION_OPTIONS
+	select LZO
+	depends on JFFS2_FS
+	default y
+	help
+	  LZO based compression. Generally works faster than Zlib with 
+	  a slightly lower compression ratio.
+
+	  Say 'Y' if unsure.
+
 config JFFS2_RTIME
 	bool "JFFS2 RTIME compression support" if JFFS2_COMPRESSION_OPTIONS
 	depends on JFFS2_FS
fs/jffs2/Makefile +1 -0
index c32b241..60e5d49 100644
@@ -17,4 +17,5 @@ jffs2-$(CONFIG_JFFS2_FS_POSIX_ACL)	+= acl.o
 jffs2-$(CONFIG_JFFS2_RUBIN)	+= compr_rubin.o
 jffs2-$(CONFIG_JFFS2_RTIME)	+= compr_rtime.o
 jffs2-$(CONFIG_JFFS2_ZLIB)	+= compr_zlib.o
+jffs2-$(CONFIG_JFFS2_LZO)	+= compr_lzo.o
 jffs2-$(CONFIG_JFFS2_SUMMARY)   += summary.o
fs/jffs2/compr.c +6 -0
index 485d065..6a23408 100644
@@ -285,6 +285,9 @@ int __init jffs2_compressors_init(void)
         jffs2_rubinmips_init();
         jffs2_dynrubin_init();
 #endif
+#ifdef CONFIG_JFFS2_LZO
+        jffs2_lzo_init();
+#endif
 /* Setting default compression mode */
 #ifdef CONFIG_JFFS2_CMODE_NONE
         jffs2_compression_mode = JFFS2_COMPR_MODE_NONE;
@@ -303,6 +306,9 @@ int __init jffs2_compressors_init(void)
 int jffs2_compressors_exit(void)
 {
 /* Unregistering compressors */
+#ifdef CONFIG_JFFS2_LZO
+        jffs2_lzo_exit();
+#endif
 #ifdef CONFIG_JFFS2_RUBIN
         jffs2_dynrubin_exit();
         jffs2_rubinmips_exit();
fs/jffs2/compr.h +6 -1
index 68cc701..8c6b2af 100644
@@ -27,9 +27,10 @@
 #define JFFS2_RUBINMIPS_PRIORITY 10
 #define JFFS2_DYNRUBIN_PRIORITY  20
 #define JFFS2_LZARI_PRIORITY     30
-#define JFFS2_LZO_PRIORITY       40
 #define JFFS2_RTIME_PRIORITY     50
 #define JFFS2_ZLIB_PRIORITY      60
+#define JFFS2_LZO_PRIORITY       80
+
 
 #define JFFS2_RUBINMIPS_DISABLED /* RUBINs will be used only */
 #define JFFS2_DYNRUBIN_DISABLED  /*        for decompression */
@@ -90,5 +91,9 @@ void jffs2_rtime_exit(void);
 int jffs2_zlib_init(void);
 void jffs2_zlib_exit(void);
 #endif
+#ifdef CONFIG_JFFS2_LZO
+int jffs2_lzo_init(void);
+void jffs2_lzo_exit(void);
+#endif
 
 #endif /* __JFFS2_COMPR_H__ */
fs/jffs2/compr_lzo.c new file +110 -0

110 lines not on this page · raw message

include/linux/jffs2.h +1 -0
index 840631f..6b563ca 100644
@@ -46,6 +46,7 @@
 #define JFFS2_COMPR_COPY	0x04
 #define JFFS2_COMPR_DYNRUBIN	0x05
 #define JFFS2_COMPR_ZLIB	0x06
+#define JFFS2_COMPR_LZO		0x07
 /* Compatibility flags. */
 #define JFFS2_COMPAT_MASK 0xc000      /* What do to if an unknown nodetype is found */
 #define JFFS2_NODE_ACCURATE 0x2000
maintainer
#1 lore raw

fs/Kconfig config JFFS2_ZLIB · line 1315

Quoted 3 lines · Richard Purdie
fs/Kconfig +3 -0
+config JFFS2_LZO
+       bool "JFFS2 LZO compression support" if JFFS2_COMPRESSION_OPTIONS
+       select LZO 

Please make it _depend_ on LZO instead. If you do that, I can merge the JFFS2 bits in anticipation of the core LZO code going upstream.

Signature · 1 line
dwmw2
#2 lore raw
Quoted 7 lines · On Fri, 04 May 2007 12:35:32 +0100 David Woodhouse <[email protected]> wrote:

fs/Kconfig config JFFS2_ZLIB · line 1315

Quoted 3 lines · Richard Purdie
fs/Kconfig +3 -0
+config JFFS2_LZO
+       bool "JFFS2 LZO compression support" if JFFS2_COMPRESSION_OPTIONS
+       select LZO   

Please make it _depend_ on LZO instead. If you do that, I can merge the JFFS2 bits in anticipation of the core LZO code going upstream.

Hmm...everything else in lib/Kconfig is supposed to be _selected_, not depended upon. And the only three items in there which can actually be selected by the user all begin their helptexts with

"This option is provided for the case where no in-kernel-tree modules require FOO functions".

Are you sure it's a good idea to break with existing practice? I'm concerned that nobody will ever find the JFFS2_LZO option if it means they will have to go all the way down to the "Library functions" menu and select something to make the option visible...

Haavard

maintainer
#3 lore raw
Quoted 5 lines · Haavard Skinnemoen

Hmm...everything else in lib/Kconfig is supposed to be _selected_, not depended upon. And the only three items in there which can actually be selected by the user all begin their helptexts with

Quoted 7 lines

"This option is provided for the case where no in-kernel-tree modules require FOO functions".

Are you sure it's a good idea to break with existing practice? I'm concerned that nobody will ever find the JFFS2_LZO option if it means they will have to go all the way down to the "Library functions" menu and select something to make the option visible...

That would seem be a tools problem.

Nevertheless, if I merge it with 'select', won't it break while the core LZO patches aren't yet upstream?

Of course, one could argue that that's also a tools problem. All this proliferation of 'select' is doing is moving problems around rather than solving them.

Signature · 1 line
dwmw2