kernel: update kernel 3.18 to version 3.18.23
[openwrt/staging/chunkeey.git] / target / linux / generic / patches-3.18 / 551-ubifs-fix-default-compression-selection.patch
1 --- a/fs/ubifs/sb.c
2 +++ b/fs/ubifs/sb.c
3 @@ -63,6 +63,17 @@
4 /* Default time granularity in nanoseconds */
5 #define DEFAULT_TIME_GRAN 1000000000
6
7 +static int get_default_compressor(void)
8 +{
9 + if (ubifs_compr_present(UBIFS_COMPR_LZO))
10 + return UBIFS_COMPR_LZO;
11 +
12 + if (ubifs_compr_present(UBIFS_COMPR_ZLIB))
13 + return UBIFS_COMPR_ZLIB;
14 +
15 + return UBIFS_COMPR_NONE;
16 +}
17 +
18 /**
19 * create_default_filesystem - format empty UBI volume.
20 * @c: UBIFS file-system description object
21 @@ -183,7 +194,7 @@ static int create_default_filesystem(str
22 if (c->mount_opts.override_compr)
23 sup->default_compr = cpu_to_le16(c->mount_opts.compr_type);
24 else
25 - sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO);
26 + sup->default_compr = cpu_to_le16(get_default_compressor());
27
28 generate_random_uuid(sup->uuid);
29