diff mbox series

btrfs: remove unnecessary parameter type from compression_decompress_bio

Message ID 20211227101839.77682-1-l@damenly.su (mailing list archive)
State New, archived
Headers show
Series btrfs: remove unnecessary parameter type from compression_decompress_bio | expand

Commit Message

Su Yue Dec. 27, 2021, 10:18 a.m. UTC
btrfs_decompress_bio, the only caller of compression_decompress_bio gets
type from @cb and passes it to compression_decompress_bio.
However, compression_decompress_bio can get compression type directly
from @cb.

So remove the parameter and access it through @cb.
No functional change.

Signed-off-by: Su Yue <l@damenly.su>
---
 fs/btrfs/compression.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Qu Wenruo Dec. 27, 2021, 12:01 p.m. UTC | #1
On 2021/12/27 18:18, Su Yue wrote:
> btrfs_decompress_bio, the only caller of compression_decompress_bio gets
> type from @cb and passes it to compression_decompress_bio.
> However, compression_decompress_bio can get compression type directly
> from @cb.
> 
> So remove the parameter and access it through @cb.
> No functional change.
> 
> Signed-off-by: Su Yue <l@damenly.su>

Reviewed-by: Qu Wenruo <wqu@suse.com>

And since it's decompression time, cb->compress_type should have already 
been initialized.

Thanks,
Qu
> ---
>   fs/btrfs/compression.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> index 32da97c3c19d..f941b7ed23f5 100644
> --- a/fs/btrfs/compression.c
> +++ b/fs/btrfs/compression.c
> @@ -96,10 +96,10 @@ static int compression_compress_pages(int type, struct list_head *ws,
>   	}
>   }
>   
> -static int compression_decompress_bio(int type, struct list_head *ws,
> -		struct compressed_bio *cb)
> +static int compression_decompress_bio(struct list_head *ws,
> +				      struct compressed_bio *cb)
>   {
> -	switch (type) {
> +	switch (cb->compress_type) {
>   	case BTRFS_COMPRESS_ZLIB: return zlib_decompress_bio(ws, cb);
>   	case BTRFS_COMPRESS_LZO:  return lzo_decompress_bio(ws, cb);
>   	case BTRFS_COMPRESS_ZSTD: return zstd_decompress_bio(ws, cb);
> @@ -1359,7 +1359,7 @@ static int btrfs_decompress_bio(struct compressed_bio *cb)
>   	int type = cb->compress_type;
>   
>   	workspace = get_workspace(type, 0);
> -	ret = compression_decompress_bio(type, workspace, cb);
> +	ret = compression_decompress_bio(workspace, cb);
>   	put_workspace(type, workspace);
>   
>   	return ret;
David Sterba Jan. 3, 2022, 6:17 p.m. UTC | #2
On Mon, Dec 27, 2021 at 06:18:39PM +0800, Su Yue wrote:
> btrfs_decompress_bio, the only caller of compression_decompress_bio gets
> type from @cb and passes it to compression_decompress_bio.
> However, compression_decompress_bio can get compression type directly
> from @cb.
> 
> So remove the parameter and access it through @cb.
> No functional change.
> 
> Signed-off-by: Su Yue <l@damenly.su>

Added to misc-next, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 32da97c3c19d..f941b7ed23f5 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -96,10 +96,10 @@  static int compression_compress_pages(int type, struct list_head *ws,
 	}
 }
 
-static int compression_decompress_bio(int type, struct list_head *ws,
-		struct compressed_bio *cb)
+static int compression_decompress_bio(struct list_head *ws,
+				      struct compressed_bio *cb)
 {
-	switch (type) {
+	switch (cb->compress_type) {
 	case BTRFS_COMPRESS_ZLIB: return zlib_decompress_bio(ws, cb);
 	case BTRFS_COMPRESS_LZO:  return lzo_decompress_bio(ws, cb);
 	case BTRFS_COMPRESS_ZSTD: return zstd_decompress_bio(ws, cb);
@@ -1359,7 +1359,7 @@  static int btrfs_decompress_bio(struct compressed_bio *cb)
 	int type = cb->compress_type;
 
 	workspace = get_workspace(type, 0);
-	ret = compression_decompress_bio(type, workspace, cb);
+	ret = compression_decompress_bio(workspace, cb);
 	put_workspace(type, workspace);
 
 	return ret;