summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorDavid Sterba2017-07-17 18:11:10 +0200
committerDavid Sterba2017-08-16 16:12:05 +0200
commita7164fa4e055daf6368cb68ed946aa5a362a1a75 (patch)
tree93e9b46b4ceedcf6ebab977408e57a35e4901f5f /fs/btrfs/super.c
parentbtrfs: allow defrag compress to override NOCOMPRESS attribute (diff)
downloadkernel-qcow2-linux-a7164fa4e055daf6368cb68ed946aa5a362a1a75.tar.gz
kernel-qcow2-linux-a7164fa4e055daf6368cb68ed946aa5a362a1a75.tar.xz
kernel-qcow2-linux-a7164fa4e055daf6368cb68ed946aa5a362a1a75.zip
btrfs: prepare for extensions in compression options
This is a minimal patch intended to be backported to older kernels. We're going to extend the string specifying the compression method and this would fail on kernels before that change (the string is compared exactly). Relax the string matching only to the prefix, ie. ignoring anything that goes after "zlib" or "lzo", regardless of th format extension we decide to use. This applies to the mount options and properties. That way, patched old kernels could be booted on systems already utilizing the new compression spec. Applicable since commit 63541927c8d11, v3.14. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 64981fc8e39e..8a9bcad3b06a 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -499,14 +499,14 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
btrfs_test_opt(info, FORCE_COMPRESS);
if (token == Opt_compress ||
token == Opt_compress_force ||
- strcmp(args[0].from, "zlib") == 0) {
+ strncmp(args[0].from, "zlib", 4) == 0) {
compress_type = "zlib";
info->compress_type = BTRFS_COMPRESS_ZLIB;
btrfs_set_opt(info->mount_opt, COMPRESS);
btrfs_clear_opt(info->mount_opt, NODATACOW);
btrfs_clear_opt(info->mount_opt, NODATASUM);
no_compress = 0;
- } else if (strcmp(args[0].from, "lzo") == 0) {
+ } else if (strncmp(args[0].from, "lzo", 3) == 0) {
compress_type = "lzo";
info->compress_type = BTRFS_COMPRESS_LZO;
btrfs_set_opt(info->mount_opt, COMPRESS);