[PATCH v2] erofs: use Z_EROFS_LCLUSTER_TYPE_MAX to simplify switches
Gao Xiang
hsiangkao at linux.alibaba.com
Fri Feb 7 20:10:51 AEDT 2025
Hi Hongbo,
On 2025/2/7 16:57, Hongbo Li via Linux-erofs wrote:
>
...
>>> @@ -329,35 +328,31 @@ static int z_erofs_get_extent_compressedlen(struct z_erofs_maprecorder *m,
>>> DBG_BUGON(lcn == initial_lcn &&
>>> m->type == Z_EROFS_LCLUSTER_TYPE_NONHEAD);
>>> - switch (m->type) {
>>> - case Z_EROFS_LCLUSTER_TYPE_PLAIN:
>>> - case Z_EROFS_LCLUSTER_TYPE_HEAD1:
>>> - case Z_EROFS_LCLUSTER_TYPE_HEAD2:
>>> + if (m->type >= Z_EROFS_LCLUSTER_TYPE_MAX) {
>>> + erofs_err(sb, "cannot found CBLKCNT @ lcn %lu of nid %llu", lcn, vi->nid);
>>> + DBG_BUGON(1);
>>> + return -EFSCORRUPTED;
>>> + }
>>
>> No, I don't think it's equivalent, please use
>> the previous version for this part instead.
>
> I think this version doesn't consider the fallthrough case. May be just use the goto statement can keep equivalent.
For this particular part, I tend to use the first
version since it's already simple enough anyway.
Thanks,
Gao Xiang
>
> Thanks,
> Hongbo
>
>>
>> Thanks,
>> Gao Xiang
More information about the Linux-erofs
mailing list