[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YUAm+kOdKcCzgcEy@B-P7TQMD6M-0146.local>
Date: Tue, 14 Sep 2021 12:37:14 +0800
From: Gao Xiang <hsiangkao@...ux.alibaba.com>
To: Yue Hu <zbestahu@...il.com>
Cc: xiang@...nel.org, chao@...nel.org, linux-erofs@...ts.ozlabs.org,
linux-kernel@...r.kernel.org, huyue2@...ong.com,
zhangwen@...ong.com, zbestahu@....com
Subject: Re: [PATCH] erofs: fix compacted_2b if compacted_4b_initial >
totalidx
On Tue, Sep 14, 2021 at 11:59:15AM +0800, Yue Hu wrote:
> From: Yue Hu <huyue2@...ong.com>
>
> Currently, the whole indexes will only be compacted 4B if
> compacted_4b_initial > totalidx. So, the calculated compacted_2b
> is worthless for that case. It may waste CPU resources.
>
> No need to update compacted_4b_initial as mkfs since it's used to
> fulfill the alignment of the 1st compacted_2b pack and would handle
> the case above.
>
> We also need to clarify compacted_4b_end here. It's used for the
> last lclusters which aren't fitted in the previous compacted_2b
> packs.
>
> Some messages are from Xiang.
>
> Signed-off-by: Yue Hu <huyue2@...ong.com>
Looks good to me,
Reviewed-by: Gao Xiang <hsiangkao@...ux.alibaba.com>
(although I think the subject title would be better changed into
"clear compacted_2b if compacted_4b_initial > totalidx"
since 'fix'-likewise words could trigger some AI bot for stable
kernel backporting..)
Thanks,
Gao Xiang
> ---
> fs/erofs/zmap.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
> index 9fb98d8..aeed404 100644
> --- a/fs/erofs/zmap.c
> +++ b/fs/erofs/zmap.c
> @@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
> if (compacted_4b_initial == 32 / 4)
> compacted_4b_initial = 0;
>
> - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B)
> + if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) &&
> + compacted_4b_initial <= totalidx) {
> compacted_2b = rounddown(totalidx - compacted_4b_initial, 16);
> else
> compacted_2b = 0;
> --
> 1.9.1
Powered by blists - more mailing lists