All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: btrfs_decompress_bio() could accept compressed_bio instead
@ 2017-05-24  3:01 Anand Jain
  2017-05-24 14:17 ` Nikolay Borisov
  0 siblings, 1 reply; 3+ messages in thread
From: Anand Jain @ 2017-05-24  3:01 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

Instead of sending each argument of struct compressed_bio, send
the compressed_bio itself.

Also by having struct compressed_bio in btrfs_decompress_bio()
it would help tracing.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
This patch is preparatory for the up coming patch
 btrfs: add compression trace points

 fs/btrfs/compression.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 10e6b282d09d..ee934e612f15 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -81,9 +81,7 @@ struct compressed_bio {
 	u32 sums;
 };
 
-static int btrfs_decompress_bio(int type, struct page **pages_in,
-				   u64 disk_start, struct bio *orig_bio,
-				   size_t srclen);
+static int btrfs_decompress_bio(struct compressed_bio *cb);
 
 static inline int compressed_bio_size(struct btrfs_fs_info *fs_info,
 				      unsigned long disk_size)
@@ -173,11 +171,8 @@ static void end_compressed_bio_read(struct bio *bio)
 	/* ok, we're the last bio for this extent, lets start
 	 * the decompression.
 	 */
-	ret = btrfs_decompress_bio(cb->compress_type,
-				      cb->compressed_pages,
-				      cb->start,
-				      cb->orig_bio,
-				      cb->compressed_len);
+	ret = btrfs_decompress_bio(cb);
+
 csum_failed:
 	if (ret)
 		cb->errors = 1;
@@ -961,18 +956,18 @@ int btrfs_compress_pages(int type, struct address_space *mapping,
  * be contiguous.  They all correspond to the range of bytes covered by
  * the compressed extent.
  */
-static int btrfs_decompress_bio(int type, struct page **pages_in,
-				   u64 disk_start, struct bio *orig_bio,
-				   size_t srclen)
+static int btrfs_decompress_bio(struct compressed_bio *cb)
 {
 	struct list_head *workspace;
 	int ret;
+	int type = cb->compress_type;
 
 	workspace = find_workspace(type);
 
-	ret = btrfs_compress_op[type-1]->decompress_bio(workspace, pages_in,
-							 disk_start, orig_bio,
-							 srclen);
+	ret = btrfs_compress_op[type-1]->decompress_bio(workspace,
+			cb->compressed_pages, cb->start, cb->orig_bio,
+			cb->compressed_len);
+
 	free_workspace(type, workspace);
 	return ret;
 }
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: btrfs_decompress_bio() could accept compressed_bio instead
  2017-05-24  3:01 [PATCH] btrfs: btrfs_decompress_bio() could accept compressed_bio instead Anand Jain
@ 2017-05-24 14:17 ` Nikolay Borisov
  2017-05-26  7:45   ` Anand Jain
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Borisov @ 2017-05-24 14:17 UTC (permalink / raw)
  To: Anand Jain, linux-btrfs; +Cc: dsterba



On 24.05.2017 06:01, Anand Jain wrote:
> Instead of sending each argument of struct compressed_bio, send
> the compressed_bio itself.
> 
> Also by having struct compressed_bio in btrfs_decompress_bio()
> it would help tracing.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> This patch is preparatory for the up coming patch
>  btrfs: add compression trace points
> 
>  fs/btrfs/compression.c | 23 +++++++++--------------
>  1 file changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> index 10e6b282d09d..ee934e612f15 100644
> --- a/fs/btrfs/compression.c
> +++ b/fs/btrfs/compression.c
> @@ -81,9 +81,7 @@ struct compressed_bio {
>  	u32 sums;
>  };
>  
> -static int btrfs_decompress_bio(int type, struct page **pages_in,
> -				   u64 disk_start, struct bio *orig_bio,
> -				   size_t srclen);
> +static int btrfs_decompress_bio(struct compressed_bio *cb);
>  
>  static inline int compressed_bio_size(struct btrfs_fs_info *fs_info,
>  				      unsigned long disk_size)
> @@ -173,11 +171,8 @@ static void end_compressed_bio_read(struct bio *bio)
>  	/* ok, we're the last bio for this extent, lets start
>  	 * the decompression.
>  	 */
> -	ret = btrfs_decompress_bio(cb->compress_type,
> -				      cb->compressed_pages,
> -				      cb->start,
> -				      cb->orig_bio,
> -				      cb->compressed_len);
> +	ret = btrfs_decompress_bio(cb);
> +
>  csum_failed:
>  	if (ret)
>  		cb->errors = 1;
> @@ -961,18 +956,18 @@ int btrfs_compress_pages(int type, struct address_space *mapping,
>   * be contiguous.  They all correspond to the range of bytes covered by
>   * the compressed extent.
>   */
> -static int btrfs_decompress_bio(int type, struct page **pages_in,
> -				   u64 disk_start, struct bio *orig_bio,
> -				   size_t srclen)
> +static int btrfs_decompress_bio(struct compressed_bio *cb)
>  {
>  	struct list_head *workspace;
>  	int ret;
> +	int type = cb->compress_type;
>  
>  	workspace = find_workspace(type);
>  
> -	ret = btrfs_compress_op[type-1]->decompress_bio(workspace, pages_in,
> -							 disk_start, orig_bio,
> -							 srclen);
> +	ret = btrfs_compress_op[type-1]->decompress_bio(workspace,
> +			cb->compressed_pages, cb->start, cb->orig_bio,
> +			cb->compressed_len);
> +
>  	free_workspace(type, workspace);
>  	return ret;
>  }
> 

Can you take this idea one notch further and refactor also
zlib_decompress_bio and lzo_decompress_bio functions as well?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: btrfs_decompress_bio() could accept compressed_bio instead
  2017-05-24 14:17 ` Nikolay Borisov
@ 2017-05-26  7:45   ` Anand Jain
  0 siblings, 0 replies; 3+ messages in thread
From: Anand Jain @ 2017-05-26  7:45 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs; +Cc: dsterba


>
> Can you take this idea one notch further and refactor also
> zlib_decompress_bio and lzo_decompress_bio functions as well?

  Done. Added in v2.

Thanks, Anand

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-26  7:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24  3:01 [PATCH] btrfs: btrfs_decompress_bio() could accept compressed_bio instead Anand Jain
2017-05-24 14:17 ` Nikolay Borisov
2017-05-26  7:45   ` Anand Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.