Use EROFS_BLKSIZ only in the codebase and just warn potential incompatible PAGE_SIZE.
It fixes, http://autobuild.buildroot.net/results/2daa0f7a7418f7491b8b4c5495904abb86efa809/build-end.log Signed-off-by: Gao Xiang <[email protected]> --- include/erofs/internal.h | 2 +- lib/compressor.c | 4 ++-- lib/data.c | 6 +++--- lib/dir.c | 2 +- lib/namei.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/erofs/internal.h b/include/erofs/internal.h index 2686570..6a70f11 100644 --- a/include/erofs/internal.h +++ b/include/erofs/internal.h @@ -36,7 +36,7 @@ typedef unsigned short umode_t; /* no obvious reason to support explicit PAGE_SIZE != 4096 for now */ #if PAGE_SIZE != 4096 -#error incompatible PAGE_SIZE is already defined +#warning EROFS may be incompatible on your platform #endif #ifndef PAGE_MASK diff --git a/lib/compressor.c b/lib/compressor.c index 3666496..a46bc39 100644 --- a/lib/compressor.c +++ b/lib/compressor.c @@ -76,8 +76,8 @@ int erofs_compressor_init(struct erofs_compress *c, char *alg_name) c->compress_threshold = 100; /* optimize for 4k size page */ - c->destsize_alignsize = PAGE_SIZE; - c->destsize_redzone_begin = PAGE_SIZE - 16; + c->destsize_alignsize = EROFS_BLKSIZ; + c->destsize_redzone_begin = EROFS_BLKSIZ - 16; c->destsize_redzone_end = EROFS_CONFIG_COMPR_DEF_BOUNDARY; if (!alg_name) { diff --git a/lib/data.c b/lib/data.c index e57707e..6bc554d 100644 --- a/lib/data.c +++ b/lib/data.c @@ -22,7 +22,7 @@ static int erofs_map_blocks_flatmode(struct erofs_inode *inode, trace_erofs_map_blocks_flatmode_enter(inode, map, flags); - nblocks = DIV_ROUND_UP(inode->i_size, PAGE_SIZE); + nblocks = DIV_ROUND_UP(inode->i_size, EROFS_BLKSIZ); lastblk = nblocks - tailendpacking; /* there is no hole in flatmode */ @@ -37,8 +37,8 @@ static int erofs_map_blocks_flatmode(struct erofs_inode *inode, vi->xattr_isize + erofs_blkoff(map->m_la); map->m_plen = inode->i_size - offset; - /* inline data should be located in one meta block */ - if (erofs_blkoff(map->m_pa) + map->m_plen > PAGE_SIZE) { + /* inline data should be located in the same meta block */ + if (erofs_blkoff(map->m_pa) + map->m_plen > EROFS_BLKSIZ) { erofs_err("inline data cross block boundary @ nid %" PRIu64, vi->nid); DBG_BUGON(1); diff --git a/lib/dir.c b/lib/dir.c index 8955931..e6b9283 100644 --- a/lib/dir.c +++ b/lib/dir.c @@ -148,7 +148,7 @@ int erofs_iterate_dir(struct erofs_dir_context *ctx, bool fsck) nameoff = le16_to_cpu(de->nameoff); if (nameoff < sizeof(struct erofs_dirent) || - nameoff >= PAGE_SIZE) { + nameoff >= EROFS_BLKSIZ) { erofs_err("invalid de[0].nameoff %u @ nid %llu, lblk %u", nameoff, dir->nid | 0ULL, lblk); return -EFSCORRUPTED; diff --git a/lib/namei.c b/lib/namei.c index 8e9867d..7b69a59 100644 --- a/lib/namei.c +++ b/lib/namei.c @@ -212,7 +212,7 @@ int erofs_namei(struct nameidata *nd, nameoff = le16_to_cpu(de->nameoff); if (nameoff < sizeof(struct erofs_dirent) || - nameoff >= PAGE_SIZE) { + nameoff >= EROFS_BLKSIZ) { erofs_err("invalid de[0].nameoff %u @ nid %llu", nameoff, nid | 0ULL); return -EFSCORRUPTED; -- 2.30.2
