linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: huyue2@coolpad.com
Cc: linux-erofs@lists.ozlabs.org, 孙士杰 <sunshijie@xiaomi.com>
Subject: Re: [PATCH] erofs-utils: limit pclustersize in z_erofs_fixup_deduped_fragment()
Date: Fri, 2 Jun 2023 14:08:33 +0800	[thread overview]
Message-ID: <9712ed04-a5ae-4c1f-7275-405e2e92f083@linux.alibaba.com> (raw)
In-Reply-To: <20230602052039.615632-1-asai@sijam.com>

Hi Yue,

On 2023/6/2 13:20, Noboru Asai wrote:
> The variable 'ctx->pclustersize' could be larger than max pclustersize.
> 
> Signed-off-by: Noboru Asai <asai@sijam.com>

Please take a look at this patch.
+Cc Shijie Sun.

Thanks,
Gao Xiang

> ---
>   lib/compress.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/compress.c b/lib/compress.c
> index 2e1dfb3..e943056 100644
> --- a/lib/compress.c
> +++ b/lib/compress.c
> @@ -359,8 +359,9 @@ static bool z_erofs_fixup_deduped_fragment(struct z_erofs_vle_compress_ctx *ctx,
>   
>   	/* try to fix again if it gets larger (should be rare) */
>   	if (inode->fragment_size < newsize) {
> -		ctx->pclustersize = roundup(newsize - inode->fragment_size,
> -					    erofs_blksiz());
> +		ctx->pclustersize = min(z_erofs_get_max_pclusterblks(inode) * erofs_blksiz(),
> +					roundup(newsize - inode->fragment_size,
> +						erofs_blksiz()));
>   		return false;
>   	}
>   

  reply	other threads:[~2023-06-02  6:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02  5:20 [PATCH] erofs-utils: limit pclustersize in z_erofs_fixup_deduped_fragment() Noboru Asai
2023-06-02  6:08 ` Gao Xiang [this message]
2023-06-02  6:25   ` 答复: [External Mail]Re: " 孙士杰 via Linux-erofs
2023-06-02  6:39 ` Yue Hu

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=9712ed04-a5ae-4c1f-7275-405e2e92f083@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=huyue2@coolpad.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=sunshijie@xiaomi.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;
as well as URLs for NNTP newsgroup(s).