diff options
author | David Sterba <dsterba@suse.com> | 2019-08-09 17:25:34 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-09-09 15:59:11 +0300 |
commit | e18333a7cb97d838c09802092fcecd3269363ecb (patch) | |
tree | 891fcb04e1cd69b5a23529a5029df99b3ff5b4d6 /fs/btrfs | |
parent | efad8a853ad2057f96664328a0d327a05ce39c76 (diff) | |
download | linux-e18333a7cb97d838c09802092fcecd3269363ecb.tar.xz |
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: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/compression.h | 4 | ||||
-rw-r--r-- | fs/btrfs/lzo.c | 2 | ||||
-rw-r--r-- | fs/btrfs/zlib.c | 2 | ||||
-rw-r--r-- | fs/btrfs/zstd.c | 2 |
4 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h index 2035b8eb1290..cffd689adb6e 100644 --- a/fs/btrfs/compression.h +++ b/fs/btrfs/compression.h @@ -162,6 +162,10 @@ struct btrfs_compress_op { * if the level is out of bounds or the default if 0 is passed in. */ 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 */ diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index 579d53ae256f..adac6cb30d65 100644 --- a/fs/btrfs/lzo.c +++ b/fs/btrfs/lzo.c @@ -523,4 +523,6 @@ const struct btrfs_compress_op btrfs_lzo_compress = { .decompress_bio = lzo_decompress_bio, .decompress = lzo_decompress, .set_level = lzo_set_level, + .max_level = 1, + .default_level = 1, }; diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index b86b7ad6b900..03d6c3683bd9 100644 --- a/fs/btrfs/zlib.c +++ b/fs/btrfs/zlib.c @@ -437,4 +437,6 @@ const struct btrfs_compress_op btrfs_zlib_compress = { .decompress_bio = zlib_decompress_bio, .decompress = zlib_decompress, .set_level = zlib_set_level, + .max_level = 9, + .default_level = BTRFS_ZLIB_DEFAULT_LEVEL, }; diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c index 3837ca180d52..b2b23a6a497d 100644 --- a/fs/btrfs/zstd.c +++ b/fs/btrfs/zstd.c @@ -729,4 +729,6 @@ const struct btrfs_compress_op btrfs_zstd_compress = { .decompress_bio = zstd_decompress_bio, .decompress = zstd_decompress, .set_level = zstd_set_level, + .max_level = ZSTD_BTRFS_MAX_LEVEL, + .default_level = ZSTD_BTRFS_DEFAULT_LEVEL, }; |