[PATCH] erofs: remove dead codes for cleanup

From: Chao Yu
Date: Mon Mar 17 2025 - 01:57:55 EST


z_erofs_extent_lookback() and z_erofs_get_extent_decompressedlen() tries
to do sanity check on m->type, however their caller z_erofs_map_blocks_fo()
has already checked that, so let's remove those dead codes.

Signed-off-by: Chao Yu <chao@xxxxxxxxxx>
---
fs/erofs/zmap.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index 8de50df05dfe..4d883ec212d7 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -265,17 +265,12 @@ static int z_erofs_extent_lookback(struct z_erofs_maprecorder *m,
if (err)
return err;

- 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) {
+ if (m->type == Z_EROFS_LCLUSTER_TYPE_NONHEAD) {
lookback_distance = m->delta[0];
if (!lookback_distance)
break;
continue;
- } else {
+ } else if (m->type < Z_EROFS_LCLUSTER_TYPE_MAX) {
m->headtype = m->type;
m->map->m_la = (lcn << lclusterbits) | m->clusterofs;
return 0;
@@ -379,11 +374,6 @@ static int z_erofs_get_extent_decompressedlen(struct z_erofs_maprecorder *m)
if (lcn != headlcn)
break; /* ends at the next HEAD lcluster */
m->delta[1] = 1;
- } else {
- erofs_err(inode->i_sb, "unknown type %u @ lcn %llu of nid %llu",
- m->type, lcn, vi->nid);
- DBG_BUGON(1);
- return -EOPNOTSUPP;
}
lcn += m->delta[1];
}
--
2.48.1

>
> Thanks,
> Gao Xiang
>