diff options
author | Dennis Zhou <dennis@kernel.org> | 2019-02-04 21:19:57 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-02-25 14:13:30 +0100 |
commit | 1972708a897e99b25cd7d246bd37d44a592c4b54 (patch) | |
tree | e8297f7868f6e7eb09c4fe3141cab479ee37d278 /fs/btrfs/compression.h | |
parent | btrfs: introduce new ioctl to unregister a btrfs device (diff) | |
download | linux-1972708a897e99b25cd7d246bd37d44a592c4b54.tar.xz linux-1972708a897e99b25cd7d246bd37d44a592c4b54.zip |
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/compression.h')
-rw-r--r-- | fs/btrfs/compression.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h index ddda9b80bf20..004db0b3111b 100644 --- a/fs/btrfs/compression.h +++ b/fs/btrfs/compression.h @@ -64,6 +64,16 @@ struct compressed_bio { u32 sums; }; +static inline unsigned int btrfs_compress_type(unsigned int type_level) +{ + return (type_level & 0xF); +} + +static inline unsigned int btrfs_compress_level(unsigned int type_level) +{ + return ((type_level & 0xF0) >> 4); +} + void __init btrfs_init_compress(void); void __cold btrfs_exit_compress(void); |