[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <29c5e464-4a11-42f4-b303-279c4b642471@linux.alibaba.com>
Date: Fri, 7 Feb 2025 17:14:23 +0800
From: Gao Xiang <hsiangkao@...ux.alibaba.com>
To: Hongzhen Luo <hongzhen@...ux.alibaba.com>, linux-erofs@...ts.ozlabs.org
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] erofs: use Z_EROFS_LCLUSTER_TYPE_MAX to simplify
switches
On 2025/2/7 16:50, Hongzhen Luo wrote:
> There's no need to enumerate each type. No logic changes.
>
> Signed-off-by: Hongzhen Luo <hongzhen@...ux.alibaba.com>
> ---> v3: Code cleanup, remove logically inequivalent changes.
> v2: https://lore.kernel.org/all/20250207080829.2405528-1-hongzhen@linux.alibaba.com/
> v1: https://lore.kernel.org/all/20250207064135.2249529-1-hongzhen@linux.alibaba.com/
> ---
> fs/erofs/zmap.c | 60 +++++++++++++++++++------------------------------
> 1 file changed, 23 insertions(+), 37 deletions(-)
>
> diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
> index 689437e99a5a..7dba1573498b 100644
> --- a/fs/erofs/zmap.c
> +++ b/fs/erofs/zmap.c
> @@ -265,23 +265,20 @@ static int z_erofs_extent_lookback(struct z_erofs_maprecorder *m,
> if (err)
> return err;
>
> - switch (m->type) {
> - case Z_EROFS_LCLUSTER_TYPE_NONHEAD:
> + if (m->type >= Z_EROFS_LCLUSTER_TYPE_MAX) {
> + erofs_err(sb, "unknown type %u @ lcn %lu of nid %llu",
> + m->type, lcn, vi->nid);
> + DBG_BUGON(1);
> + return -EOPNOTSUPP;
> + } else if (m->type == Z_EROFS_LCLUSTER_TYPE_NONHEAD) {
> lookback_distance = m->delta[0];
> if (!lookback_distance)
> goto err_bogus;'
Maybe just kill `goto err_bogus;` too, like:
if (!lookback_distance) {
erofs_err(sb, "bogus lookback distance %u @ lcn %lu of nid %llu",
lookback_distance, m->lcn, vi->nid);
DBG_BUGON(1);
return -EFSCORRUPTED;
}
Otherwise it looks good to me.
Thanks,
Gao Xiang
Powered by blists - more mailing lists