diff options
author | Andres Salomon <dilinger@queued.net> | 2011-10-16 21:15:23 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-10-19 10:22:21 -0400 |
commit | 123005f3ccfa58637ad6e1a8b9f7f3f861ca65f4 (patch) | |
tree | a9bd8a539d9c950f47514a5f94f65c25c09e3b6c /fs/jffs2/super.c | |
parent | 92abc475d8de1c29373f6d96ed63d8ecaa199d25 (diff) |
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>
Diffstat (limited to 'fs/jffs2/super.c')
-rw-r--r-- | fs/jffs2/super.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 40f6e6385fd1..e7e974454115 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -82,6 +82,14 @@ static const char *jffs2_compr_name(unsigned int compr) | |||
82 | switch (compr) { | 82 | switch (compr) { |
83 | case JFFS2_COMPR_MODE_NONE: | 83 | case JFFS2_COMPR_MODE_NONE: |
84 | return "none"; | 84 | return "none"; |
85 | #ifdef CONFIG_JFFS2_LZO | ||
86 | case JFFS2_COMPR_MODE_FORCELZO: | ||
87 | return "lzo"; | ||
88 | #endif | ||
89 | #ifdef CONFIG_JFFS2_ZLIB | ||
90 | case JFFS2_COMPR_MODE_FORCEZLIB: | ||
91 | return "zlib"; | ||
92 | #endif | ||
85 | default: | 93 | default: |
86 | /* should never happen; programmer error */ | 94 | /* should never happen; programmer error */ |
87 | WARN_ON(1); | 95 | WARN_ON(1); |
@@ -195,11 +203,25 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data) | |||
195 | 203 | ||
196 | if (!name) | 204 | if (!name) |
197 | return -ENOMEM; | 205 | return -ENOMEM; |
198 | if (!strcmp(name, "none")) { | 206 | if (!strcmp(name, "none")) |
199 | c->mount_opts.compr = JFFS2_COMPR_MODE_NONE; | 207 | c->mount_opts.compr = JFFS2_COMPR_MODE_NONE; |
200 | c->mount_opts.override_compr = true; | 208 | #ifdef CONFIG_JFFS2_LZO |
209 | else if (!strcmp(name, "lzo")) | ||
210 | c->mount_opts.compr = JFFS2_COMPR_MODE_FORCELZO; | ||
211 | #endif | ||
212 | #ifdef CONFIG_JFFS2_ZLIB | ||
213 | else if (!strcmp(name, "zlib")) | ||
214 | c->mount_opts.compr = | ||
215 | JFFS2_COMPR_MODE_FORCEZLIB; | ||
216 | #endif | ||
217 | else { | ||
218 | printk(KERN_ERR "JFFS2 Error: unknown compressor \"%s\"", | ||
219 | name); | ||
220 | kfree(name); | ||
221 | return -EINVAL; | ||
201 | } | 222 | } |
202 | kfree(name); | 223 | kfree(name); |
224 | c->mount_opts.override_compr = true; | ||
203 | break; | 225 | break; |
204 | default: | 226 | default: |
205 | printk(KERN_ERR "JFFS2 Error: unrecognized mount option '%s' or missing value\n", | 227 | printk(KERN_ERR "JFFS2 Error: unrecognized mount option '%s' or missing value\n", |