btrfs: unexport btrfs_compress_set_level()
PATCH 1/1 btrfs: unexport btrfs_compress_set_level()
btrfs_compress_set_level() can be static function in the file compression.c.
a common helper)
--- fs/btrfs/compression.c | 32 ++++++++++++++++---------------- fs/btrfs/compression.h | 2 -- 2 files changed, 16 insertions(+), 18 deletions(-)
fs/btrfs/compression.c +16 -16
@@ -1141,6 +1141,22 @@ static void put_workspace(int type, struct list_head *ws) } } +/* +* Adjust @level according to the limits of the compression algorithm or +* fallback to default +*/ +static unsigned int btrfs_compress_set_level (int type,unsigned level) +{ +const struct btrfs_compress_op *ops = btrfs_compress_op[type]; + +if (level ==0 ) + level = ops->default_level; +else + level =min (level, ops->max_level); + +return level; +} +/* * Given an address space and start and length, compress the bytes into @pages * that are allocated on demand.
@@ -1748,19 +1764,3 @@ unsigned int btrfs_compress_str2level(unsigned int type, const char *str)return level; } - -/* -* Adjust @level according to the limits of the compression algorithm or -* fallback to default -*/ -unsigned int btrfs_compress_set_level (int type,unsigned level) -{ -const struct btrfs_compress_op *ops = btrfs_compress_op[type]; - -if (level ==0 ) - level = ops->default_level; -else - level =min (level, ops->max_level); - -return level; -}
fs/btrfs/compression.h +0 -2
@@ -140,8 +140,6 @@ extern const struct btrfs_compress_op btrfs_zstd_compress;const char *btrfs_compress_type2str (enum btrfs_compression_type type);bool btrfs_compress_is_valid_type (const char *str,size_t len); -unsigned int btrfs_compress_set_level (int type,unsigned level); -int btrfs_compress_heuristic (struct inode *inode,u64 start,u64 end);#endif
Signature · 1 line
2.25.1
On 12/05/2020 07:38, Anand Jain wrote:
[...]
Quoted 16 lines
fs/btrfs/compression.c +16
-0+/* +* Adjust @level according to the limits of the compression algorithm or +* fallback to default +*/ +static unsigned int btrfs_compress_set_level (int type,unsigned level) +{ +const struct btrfs_compress_op *ops = btrfs_compress_op[type]; + +if (level ==0 ) + level = ops->default_level; +else + level =min (level, ops->max_level); + +return level; +} +
[...]
Quoted 5 lines
fs/btrfs/compression.c +0
-5-/* -* Adjust @level according to the limits of the compression algorithm or -* fallback to default -*/ -unsigned int btrfs_compress_set_level (int type,unsigned level)
fs/btrfs/compression.c unsigned int btrfs_compress_str2level(unsigned int type, const char *str) · line 1766
Quoted 10 lines
fs/btrfs/compression.c +0
-10-{ -const struct btrfs_compress_op *ops = btrfs_compress_op[type]; - -if (level ==0 ) - level = ops->default_level; -else - level =min (level, ops->max_level); - -return level; -}
Why did you move the function?
Apart from that,
Quoted 2 lines
Why did you move the function?
Oh. In the original code, in compression.c the function call (in btrfs_compress_pages()) come first before the function definition. So to avoid the re-declaration moved the function up.
Quoted 2 lines
Apart from that,
Reviewed-by Johannes Thumshirn <[email protected]>
Thanks.
Quoted 12 lines · Anand Jain
Quoted 2 lines
Why did you move the function?
Oh. In the original code, in
compression.cthe function call (inbtrfs_compress_pages()) come first before the function definition. So to avoid the re-declaration moved the function up.Quoted 2 lines
Apart from that,
Reviewed-by Johannes Thumshirn <[email protected]>Thanks.
Ok, thanks.
Quoted 5 lines · Anand Jain
btrfs_compress_set_level()can be static function in the filecompression.c.Fixes b0c1fe1eaf5e (btrfs: compression: replace set_level callbacks bya common helper)
Not really a candidate for Fixes, there's no bug. Otherwise ok, added to misc-next.