btrfs: compression: replace set_level callbacks by a common helper

The set_level callbacks do not do anything special and can be replaced
by a helper that uses the levels defined in the tables.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba
2019-08-09 16:49:06 +02:00
parent e18333a7cb
commit b0c1fe1eaf
5 changed files with 20 additions and 33 deletions

View File

@@ -418,14 +418,6 @@ next:
return ret;
}
static unsigned int zlib_set_level(unsigned int level)
{
if (!level)
return BTRFS_ZLIB_DEFAULT_LEVEL;
return min_t(unsigned int, level, 9);
}
const struct btrfs_compress_op btrfs_zlib_compress = {
.init_workspace_manager = zlib_init_workspace_manager,
.cleanup_workspace_manager = zlib_cleanup_workspace_manager,
@@ -436,7 +428,6 @@ const struct btrfs_compress_op btrfs_zlib_compress = {
.compress_pages = zlib_compress_pages,
.decompress_bio = zlib_decompress_bio,
.decompress = zlib_decompress,
.set_level = zlib_set_level,
.max_level = 9,
.default_level = BTRFS_ZLIB_DEFAULT_LEVEL,
};