btrfs: compression: add helper for type to string conversion
commit e128f9c3f7
upstream.
There are several places opencoding this conversion, add a helper now
that we have 3 compression algorithms.
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f37ed9bc10
commit
fae7ff46be
@ -43,6 +43,21 @@
|
|||||||
#include "extent_io.h"
|
#include "extent_io.h"
|
||||||
#include "extent_map.h"
|
#include "extent_map.h"
|
||||||
|
|
||||||
|
static const char* const btrfs_compress_types[] = { "", "zlib", "lzo", "zstd" };
|
||||||
|
|
||||||
|
const char* btrfs_compress_type2str(enum btrfs_compression_type type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case BTRFS_COMPRESS_ZLIB:
|
||||||
|
case BTRFS_COMPRESS_LZO:
|
||||||
|
case BTRFS_COMPRESS_ZSTD:
|
||||||
|
case BTRFS_COMPRESS_NONE:
|
||||||
|
return btrfs_compress_types[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static int btrfs_decompress_bio(struct compressed_bio *cb);
|
static int btrfs_decompress_bio(struct compressed_bio *cb);
|
||||||
|
|
||||||
static inline int compressed_bio_size(struct btrfs_fs_info *fs_info,
|
static inline int compressed_bio_size(struct btrfs_fs_info *fs_info,
|
||||||
|
@ -130,6 +130,8 @@ extern const struct btrfs_compress_op btrfs_zlib_compress;
|
|||||||
extern const struct btrfs_compress_op btrfs_lzo_compress;
|
extern const struct btrfs_compress_op btrfs_lzo_compress;
|
||||||
extern const struct btrfs_compress_op btrfs_zstd_compress;
|
extern const struct btrfs_compress_op btrfs_zstd_compress;
|
||||||
|
|
||||||
|
const char* btrfs_compress_type2str(enum btrfs_compression_type type);
|
||||||
|
|
||||||
int btrfs_compress_heuristic(struct inode *inode, u64 start, u64 end);
|
int btrfs_compress_heuristic(struct inode *inode, u64 start, u64 end);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user