jffs2: add compr=lzo and compr=zlib options
..to allow forcing of either compression scheme. This will override
compiled-in defaults. jffs2_compress is reworked a bit, as the lzo/zlib
override shares lots of code w/ the PRIORITY mode.
v2: update show_options accordingly.
Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 40f6e63..e7e9744 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -82,6 +82,14 @@
switch (compr) {
case JFFS2_COMPR_MODE_NONE:
return "none";
+#ifdef CONFIG_JFFS2_LZO
+ case JFFS2_COMPR_MODE_FORCELZO:
+ return "lzo";
+#endif
+#ifdef CONFIG_JFFS2_ZLIB
+ case JFFS2_COMPR_MODE_FORCEZLIB:
+ return "zlib";
+#endif
default:
/* should never happen; programmer error */
WARN_ON(1);
@@ -195,11 +203,25 @@
if (!name)
return -ENOMEM;
- if (!strcmp(name, "none")) {
+ if (!strcmp(name, "none"))
c->mount_opts.compr = JFFS2_COMPR_MODE_NONE;
- c->mount_opts.override_compr = true;
+#ifdef CONFIG_JFFS2_LZO
+ else if (!strcmp(name, "lzo"))
+ c->mount_opts.compr = JFFS2_COMPR_MODE_FORCELZO;
+#endif
+#ifdef CONFIG_JFFS2_ZLIB
+ else if (!strcmp(name, "zlib"))
+ c->mount_opts.compr =
+ JFFS2_COMPR_MODE_FORCEZLIB;
+#endif
+ else {
+ printk(KERN_ERR "JFFS2 Error: unknown compressor \"%s\"",
+ name);
+ kfree(name);
+ return -EINVAL;
}
kfree(name);
+ c->mount_opts.override_compr = true;
break;
default:
printk(KERN_ERR "JFFS2 Error: unrecognized mount option '%s' or missing value\n",