summaryrefslogtreecommitdiff
path: root/fs/btrfs/zlib.c
diff options
context:
space:
mode:
authorDennis Zhou <dennis@kernel.org>2019-02-04 15:19:57 -0500
committerDavid Sterba <dsterba@suse.com>2019-02-25 14:13:30 +0100
commit1972708a897e99b25cd7d246bd37d44a592c4b54 (patch)
treee8297f7868f6e7eb09c4fe3141cab479ee37d278 /fs/btrfs/zlib.c
parent228a73abde5c04428678e917b271f8526cfd90ed (diff)
btrfs: add helpers for compression type and level
It is very easy to miss places that rely on a certain bitshifting for decoding the type_level overloading. Add helpers to do this instead. Cc: Omar Sandoval <osandov@osandov.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Dennis Zhou <dennis@kernel.org> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/zlib.c')
-rw-r--r--fs/btrfs/zlib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index 970ff3e35bb3..2bd655c4f8b4 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -393,7 +393,7 @@ next:
static void zlib_set_level(struct list_head *ws, unsigned int type)
{
struct workspace *workspace = list_entry(ws, struct workspace, list);
- unsigned level = (type & 0xF0) >> 4;
+ unsigned int level = btrfs_compress_level(type);
if (level > 9)
level = 9;