Commit e18333a7 authored by David Sterba's avatar David Sterba

btrfs: define compression levels statically

The maximum and default levels do not change and can be defined
directly. The set_level callback was a temporary solution and will be
removed.
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent efad8a85
...@@ -162,6 +162,10 @@ struct btrfs_compress_op { ...@@ -162,6 +162,10 @@ struct btrfs_compress_op {
* if the level is out of bounds or the default if 0 is passed in. * if the level is out of bounds or the default if 0 is passed in.
*/ */
unsigned int (*set_level)(unsigned int level); unsigned int (*set_level)(unsigned int level);
/* Maximum level supported by the compression algorithm */
unsigned int max_level;
unsigned int default_level;
}; };
/* The heuristic workspaces are managed via the 0th workspace manager */ /* The heuristic workspaces are managed via the 0th workspace manager */
......
...@@ -523,4 +523,6 @@ const struct btrfs_compress_op btrfs_lzo_compress = { ...@@ -523,4 +523,6 @@ const struct btrfs_compress_op btrfs_lzo_compress = {
.decompress_bio = lzo_decompress_bio, .decompress_bio = lzo_decompress_bio,
.decompress = lzo_decompress, .decompress = lzo_decompress,
.set_level = lzo_set_level, .set_level = lzo_set_level,
.max_level = 1,
.default_level = 1,
}; };
...@@ -437,4 +437,6 @@ const struct btrfs_compress_op btrfs_zlib_compress = { ...@@ -437,4 +437,6 @@ const struct btrfs_compress_op btrfs_zlib_compress = {
.decompress_bio = zlib_decompress_bio, .decompress_bio = zlib_decompress_bio,
.decompress = zlib_decompress, .decompress = zlib_decompress,
.set_level = zlib_set_level, .set_level = zlib_set_level,
.max_level = 9,
.default_level = BTRFS_ZLIB_DEFAULT_LEVEL,
}; };
...@@ -729,4 +729,6 @@ const struct btrfs_compress_op btrfs_zstd_compress = { ...@@ -729,4 +729,6 @@ const struct btrfs_compress_op btrfs_zstd_compress = {
.decompress_bio = zstd_decompress_bio, .decompress_bio = zstd_decompress_bio,
.decompress = zstd_decompress, .decompress = zstd_decompress,
.set_level = zstd_set_level, .set_level = zstd_set_level,
.max_level = ZSTD_BTRFS_MAX_LEVEL,
.default_level = ZSTD_BTRFS_DEFAULT_LEVEL,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment