From: Sandeep Dhavale Date: Wed, 30 Aug 2023 23:16:06 +0000 (-0700) Subject: erofs-utils: Set mkfs default blocksize based on current platform X-Git-Tag: v1.8~192 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a5f64c20af1b90429d5b39094ceff59442655db;p=platform%2Fupstream%2Ferofs-utils.git erofs-utils: Set mkfs default blocksize based on current platform Set mkfs default blocksize to current platform pagesize. This means mkfs with default options will work on current platform. If we are building image for a platform for a different blocksize, we can override default with -b option up to EROFS_MAX_BLOCK_SIZE. Signed-off-by: Sandeep Dhavale Link: https://lore.kernel.org/r/20230830231606.3783734-2-dhavale@google.com [ Gao Xiang: compare with EROFS_MAX_BLOCK_SIZE for safety. ] Signed-off-by: Gao Xiang --- diff --git a/mkfs/main.c b/mkfs/main.c index 7225c40..16da9c0 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -705,7 +705,7 @@ static void erofs_mkfs_default_options(void) cfg.c_showprogress = true; cfg.c_legacy_compress = false; cfg.c_xattr_name_filter = true; - sbi.blkszbits = ilog2(EROFS_MAX_BLOCK_SIZE); + sbi.blkszbits = ilog2(min_t(u32, getpagesize(), EROFS_MAX_BLOCK_SIZE)); sbi.feature_incompat = EROFS_FEATURE_INCOMPAT_ZERO_PADDING; sbi.feature_compat = EROFS_FEATURE_COMPAT_SB_CHKSUM | EROFS_FEATURE_COMPAT_MTIME;