lkml.org 
[lkml]   [2021]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] erofs: fix compacted_{4b_initial, 2b} when compacted_4b_initial > totalidx
Hi Yue,

On Mon, Sep 13, 2021 at 03:24:05PM +0800, Yue Hu wrote:
> From: Yue Hu <huyue2@yulong.com>
>
> mkfs.erofs will treat compacted_4b_initial & compacted_2b as 0 if
> compacted_4b_initial > totalidx, kernel should be aligned with it
> accordingly.

There is no difference between compacted_4b_initial or compacted_4b_end
for compacted 4B. Since in this way totalidx for compact 2B won't larger
than 16 (number of lclusters in a compacted 2B pack.)

So it can be handled in either compacted_4b_initial or compacted_4b_end
cases, because there are all compacted 4B.

Thanks,
Gao Xiang

>
> Signed-off-by: Yue Hu <huyue2@yulong.com>
> ---
> fs/erofs/zmap.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
> index 9fb98d8..4f941b6 100644
> --- a/fs/erofs/zmap.c
> +++ b/fs/erofs/zmap.c
> @@ -369,7 +369,10 @@ 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 (compacted_4b_initial > totalidx) {
> + compacted_4b_initial = 0;
> + compacted_2b = 0;
> + } else if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B)
> compacted_2b = rounddown(totalidx - compacted_4b_initial, 16);
> else
> compacted_2b = 0;
> --
> 1.9.1

\
 
 \ /
  Last update: 2021-09-13 10:49    [W:0.061 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site