diff options
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r-- | fs/btrfs/compression.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 66e21a4e9ea2..db41315f11eb 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -43,6 +43,22 @@ const char* btrfs_compress_type2str(enum btrfs_compression_type type) | |||
43 | return NULL; | 43 | return NULL; |
44 | } | 44 | } |
45 | 45 | ||
46 | bool btrfs_compress_is_valid_type(const char *str, size_t len) | ||
47 | { | ||
48 | int i; | ||
49 | |||
50 | for (i = 1; i < ARRAY_SIZE(btrfs_compress_types); i++) { | ||
51 | size_t comp_len = strlen(btrfs_compress_types[i]); | ||
52 | |||
53 | if (len < comp_len) | ||
54 | continue; | ||
55 | |||
56 | if (!strncmp(btrfs_compress_types[i], str, comp_len)) | ||
57 | return true; | ||
58 | } | ||
59 | return false; | ||
60 | } | ||
61 | |||
46 | static int btrfs_decompress_bio(struct compressed_bio *cb); | 62 | static int btrfs_decompress_bio(struct compressed_bio *cb); |
47 | 63 | ||
48 | static inline int compressed_bio_size(struct btrfs_fs_info *fs_info, | 64 | static inline int compressed_bio_size(struct btrfs_fs_info *fs_info, |