1
0

551-ubifs-fix-default-compression-selection.patch 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From: Gabor Juhos <juhosg@openwrt.org>
  2. Subject: fs: ubifs: fix default compression selection in ubifs
  3. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  4. ---
  5. fs/ubifs/sb.c | 13 ++++++++++++-
  6. 1 file changed, 12 insertions(+), 1 deletion(-)
  7. --- a/fs/ubifs/sb.c
  8. +++ b/fs/ubifs/sb.c
  9. @@ -63,6 +63,17 @@
  10. /* Default time granularity in nanoseconds */
  11. #define DEFAULT_TIME_GRAN 1000000000
  12. +static int get_default_compressor(void)
  13. +{
  14. + if (ubifs_compr_present(UBIFS_COMPR_LZO))
  15. + return UBIFS_COMPR_LZO;
  16. +
  17. + if (ubifs_compr_present(UBIFS_COMPR_ZLIB))
  18. + return UBIFS_COMPR_ZLIB;
  19. +
  20. + return UBIFS_COMPR_NONE;
  21. +}
  22. +
  23. /**
  24. * create_default_filesystem - format empty UBI volume.
  25. * @c: UBIFS file-system description object
  26. @@ -186,7 +197,7 @@ static int create_default_filesystem(str
  27. if (c->mount_opts.override_compr)
  28. sup->default_compr = cpu_to_le16(c->mount_opts.compr_type);
  29. else
  30. - sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO);
  31. + sup->default_compr = cpu_to_le16(get_default_compressor());
  32. generate_random_uuid(sup->uuid);