erofs-utils: use EROFS_BLKSIZ unconditionally
PATCH 1/1 erofs-utils: use EROFS_BLKSIZ unconditionally
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(-)
include/erofs/internal.h +1 -1
@@ -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
lib/compressor.c +2 -2
@@ -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) {
lib/data.c +3 -3
@@ -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 );
lib/dir.c +1 -1
@@ -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 ;
lib/namei.c +1 -1
@@ -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 ;
Signature · 1 line
2.30.2