-// SPDX-License-Identifier: GPL-2.0
+// SPDX-License-Identifier: GPL-2.0-only
/*
* linux/drivers/staging/erofs/zmap.c
*
int z_erofs_fill_inode(struct inode *inode)
{
struct erofs_vnode *const vi = EROFS_V(inode);
- struct super_block *const sb = inode->i_sb;
if (vi->datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY) {
vi->z_advise = 0;
vi->z_algorithmtype[0] = 0;
vi->z_algorithmtype[1] = 0;
- vi->z_logical_clusterbits = EROFS_SB(sb)->clusterbits;
+ vi->z_logical_clusterbits = LOG_BLOCK_SIZE;
vi->z_physical_clusterbits[0] = vi->z_logical_clusterbits;
vi->z_physical_clusterbits[1] = vi->z_logical_clusterbits;
set_bit(EROFS_V_Z_INITED_BIT, &vi->flags);
if (vi->z_algorithmtype[0] >= Z_EROFS_COMPRESSION_MAX) {
errln("unknown compression format %u for nid %llu, please upgrade kernel",
vi->z_algorithmtype[0], vi->nid);
- err = -ENOTSUPP;
+ err = -EOPNOTSUPP;
goto unmap_done;
}
if (vi->z_physical_clusterbits[0] != LOG_BLOCK_SIZE) {
errln("unsupported physical clusterbits %u for nid %llu, please upgrade kernel",
vi->z_physical_clusterbits[0], vi->nid);
- err = -ENOTSUPP;
+ err = -EOPNOTSUPP;
goto unmap_done;
}
break;
default:
DBG_BUGON(1);
- return -EIO;
+ return -EOPNOTSUPP;
}
m->type = type;
return 0;
else if (1 << amortizedshift == 2 && lclusterbits == 12)
vcnt = 16;
else
- return -ENOTSUPP;
+ return -EOPNOTSUPP;
encodebits = ((vcnt << amortizedshift) - sizeof(__le32)) * 8 / vcnt;
base = round_down(eofs, vcnt << amortizedshift);
int err;
if (lclusterbits != 12)
- return -ENOTSUPP;
+ return -EOPNOTSUPP;
if (lcn >= totalidx)
return -EINVAL;
int err;
if (lcn < lookback_distance) {
+ errln("bogus lookback distance @ nid %llu", vi->nid);
DBG_BUGON(1);
- return -EIO;
+ return -EFSCORRUPTED;
}
/* load extent head logical cluster if needed */
errln("unknown type %u at lcn %lu of nid %llu",
m->type, lcn, vi->nid);
DBG_BUGON(1);
- return -EIO;
+ return -EOPNOTSUPP;
}
return 0;
}
if (unlikely(!m.lcn)) {
errln("invalid logical cluster 0 at nid %llu",
vi->nid);
- err = -EIO;
+ err = -EFSCORRUPTED;
goto unmap_out;
}
end = (m.lcn << lclusterbits) | m.clusterofs;
default:
errln("unknown type %u at offset %llu of nid %llu",
m.type, ofs, vi->nid);
- err = -EIO;
+ err = -EOPNOTSUPP;
goto unmap_out;
}