1 From: Gabor Juhos <juhosg@openwrt.org>
2 Subject: fs: ubifs: fix default compression selection in ubifs
4 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
6 fs/ubifs/sb.c | 13 ++++++++++++-
7 1 file changed, 12 insertions(+), 1 deletion(-)
12 /* Default time granularity in nanoseconds */
13 #define DEFAULT_TIME_GRAN 1000000000
15 +static int get_default_compressor(void)
17 + if (ubifs_compr_present(UBIFS_COMPR_LZO))
18 + return UBIFS_COMPR_LZO;
20 + if (ubifs_compr_present(UBIFS_COMPR_ZLIB))
21 + return UBIFS_COMPR_ZLIB;
23 + return UBIFS_COMPR_NONE;
27 * create_default_filesystem - format empty UBI volume.
28 * @c: UBIFS file-system description object
29 @@ -186,7 +197,7 @@ static int create_default_filesystem(str
30 if (c->mount_opts.override_compr)
31 sup->default_compr = cpu_to_le16(c->mount_opts.compr_type);
33 - sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO);
34 + sup->default_compr = cpu_to_le16(get_default_compressor());
36 generate_random_uuid(sup->uuid);