summaryrefslogtreecommitdiff
path: root/fs/btrfs/props.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-07-17 18:11:10 +0200
committerDavid Sterba <dsterba@suse.com>2017-08-16 16:12:05 +0200
commita7164fa4e055daf6368cb68ed946aa5a362a1a75 (patch)
tree93e9b46b4ceedcf6ebab977408e57a35e4901f5f /fs/btrfs/props.c
parent1e20d1c45fd37fb085dee716e1f207959e8e5660 (diff)
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/props.c')
-rw-r--r--fs/btrfs/props.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
index 916f5cf9b292..09c0266f248d 100644
--- a/fs/btrfs/props.c
+++ b/fs/btrfs/props.c
@@ -408,9 +408,9 @@ static int prop_compression_apply(struct inode *inode,
return 0;
}
- if (!strncmp("lzo", value, len))
+ if (!strncmp("lzo", value, 3))
type = BTRFS_COMPRESS_LZO;
- else if (!strncmp("zlib", value, len))
+ else if (!strncmp("zlib", value, 4))
type = BTRFS_COMPRESS_ZLIB;
else
return -EINVAL;