mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Yue Hu <zbestahu@gmail.com>,
	xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org
Cc: jefflexu@linux.alibaba.com, huyue2@coolpad.com,
	linux-kernel@vger.kernel.org, zhangwen@coolpad.com
Subject: Re: [PATCH] erofs: fold in z_erofs_decompress()
Date: Wed, 26 Apr 2023 16:15:46 +0800	[thread overview]
Message-ID: <4009badd-88f7-33e3-3abc-2c4fef10efab@linux.alibaba.com> (raw)
In-Reply-To: <20230426075943.26629-1-zbestahu@gmail.com>



On 2023/4/26 15:59, Yue Hu wrote:
> From: Yue Hu <huyue2@coolpad.com>
> 
> No need this helper since it's just a simple wrapper for decompress
> method and only one caller.  So, let's fold in directly instead.
> 
> Signed-off-by: Yue Hu <huyue2@coolpad.com>
> ---
>   fs/erofs/compress.h     | 3 +--
>   fs/erofs/decompressor.c | 8 +-------
>   fs/erofs/zdata.c        | 4 +++-
>   3 files changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/erofs/compress.h b/fs/erofs/compress.h
> index 26fa170090b8..9e423316f5a1 100644
> --- a/fs/erofs/compress.h
> +++ b/fs/erofs/compress.h
> @@ -89,8 +89,7 @@ static inline bool erofs_page_is_managed(const struct erofs_sb_info *sbi,
>   
>   int z_erofs_fixup_insize(struct z_erofs_decompress_req *rq, const char *padbuf,
>   			 unsigned int padbufsize);
> -int z_erofs_decompress(struct z_erofs_decompress_req *rq,
> -		       struct page **pagepool);
> +extern const struct z_erofs_decompressor decompressors[];
>   
>   /* prototypes for specific algorithms */
>   int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq,
> diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
> index 7021e2cf6146..5ed82b72a5a5 100644
> --- a/fs/erofs/decompressor.c
> +++ b/fs/erofs/decompressor.c
> @@ -363,7 +363,7 @@ static int z_erofs_transform_plain(struct z_erofs_decompress_req *rq,
>   	return 0;
>   }
>   
> -static struct z_erofs_decompressor decompressors[] = {
> +const struct z_erofs_decompressor decompressors[] = {

Please help rename it as erofs_decompressors.

>   	[Z_EROFS_COMPRESSION_SHIFTED] = {
>   		.decompress = z_erofs_transform_plain,
>   		.name = "shifted"
> @@ -383,9 +383,3 @@ static struct z_erofs_decompressor decompressors[] = {
>   	},
>   #endif
>   };
> -
> -int z_erofs_decompress(struct z_erofs_decompress_req *rq,
> -		       struct page **pagepool)
> -{
> -	return decompressors[rq->alg].decompress(rq, pagepool);
> -}
> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> index a90d37c7bdd7..f5c8ab176b23 100644
> --- a/fs/erofs/zdata.c
> +++ b/fs/erofs/zdata.c
> @@ -1290,6 +1290,8 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
>   	struct erofs_sb_info *const sbi = EROFS_SB(be->sb);
>   	struct z_erofs_pcluster *pcl = be->pcl;
>   	unsigned int pclusterpages = z_erofs_pclusterpages(pcl);
> +	struct z_erofs_decompressor decompressor =
> +				decompressors[pcl->algorithmformat];

Do you really need copy the struct item?
	struct z_erofs_decompressor *dec =
			erofs_decompressors[pcl->algorithmformat];

Otherwise it looks good to me.

Thanks,
Gao Xiang

>   	unsigned int i, inputsize;
>   	int err2;
>   	struct page *page;
> @@ -1333,7 +1335,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
>   	else
>   		inputsize = pclusterpages * PAGE_SIZE;
>   
> -	err = z_erofs_decompress(&(struct z_erofs_decompress_req) {
> +	err = decompressor.decompress(&(struct z_erofs_decompress_req) {
>   					.sb = be->sb,
>   					.in = be->compressed_pages,
>   					.out = be->decompressed_pages,

      reply	other threads:[~2023-04-26  8:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26  7:59 Yue Hu
2023-04-26  8:15 ` Gao Xiang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4009badd-88f7-33e3-3abc-2c4fef10efab@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=huyue2@coolpad.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiang@kernel.org \
    --cc=zbestahu@gmail.com \
    --cc=zhangwen@coolpad.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®