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(-)
9 diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
10 index 3cbb904a6d7d..460cb9e3b4ea 100644
14 /* Default time granularity in nanoseconds */
15 #define DEFAULT_TIME_GRAN 1000000000
17 +static int get_default_compressor(void)
19 + if (ubifs_compr_present(UBIFS_COMPR_LZO))
20 + return UBIFS_COMPR_LZO;
22 + if (ubifs_compr_present(UBIFS_COMPR_ZLIB))
23 + return UBIFS_COMPR_ZLIB;
25 + return UBIFS_COMPR_NONE;
29 * create_default_filesystem - format empty UBI volume.
30 * @c: UBIFS file-system description object
31 @@ -183,7 +194,7 @@ static int create_default_filesystem(struct ubifs_info *c)
32 if (c->mount_opts.override_compr)
33 sup->default_compr = cpu_to_le16(c->mount_opts.compr_type);
35 - sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO);
36 + sup->default_compr = cpu_to_le16(get_default_compressor());
38 generate_random_uuid(sup->uuid);