All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] erofs-utils: record pclustersize in bytes instead of blocks
@ 2024-04-30  6:37 Gao Xiang
  2024-04-30  6:37 ` [PATCH 2/2] erofs-utils: lib: adjust MicroLZMA default dictionary size Gao Xiang
  2024-05-01  4:54 ` [PATCH v2 1/2] erofs-utils: record pclustersize in bytes instead of blocks Gao Xiang
  0 siblings, 2 replies; 3+ messages in thread
From: Gao Xiang @ 2024-04-30  6:37 UTC (permalink / raw
  To: linux-erofs; +Cc: Gao Xiang

So that we don't need to handle blocksizes everywhere.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 include/erofs/config.h |  4 +++-
 lib/compress.c         | 30 ++++++++++++++++--------------
 lib/compress_hints.c   | 11 ++++++-----
 lib/config.c           |  2 --
 mkfs/main.c            | 16 +++++++++-------
 5 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/include/erofs/config.h b/include/erofs/config.h
index 16910ea..3ce8c59 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -79,7 +79,9 @@ struct erofs_configure {
 	u64 c_mkfs_segment_size;
 	u32 c_mt_workers;
 #endif
-	u32 c_pclusterblks_max, c_pclusterblks_def, c_pclusterblks_packed;
+	u32 c_mkfs_pclustersize_max;
+	u32 c_mkfs_pclustersize_def;
+	u32 c_mkfs_pclustersize_packed;
 	u32 c_max_decompressed_extent_bytes;
 	u64 c_unix_timestamp;
 	u32 c_uid, c_gid;
diff --git a/lib/compress.c b/lib/compress.c
index f918322..20d1568 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -416,22 +416,23 @@ static int write_uncompressed_extent(struct z_erofs_compress_sctx *ctx,
 
 static unsigned int z_erofs_get_max_pclustersize(struct erofs_inode *inode)
 {
-	unsigned int pclusterblks;
+	unsigned int pclustersize;
 
 	if (erofs_is_packed_inode(inode))
-		pclusterblks = cfg.c_pclusterblks_packed;
+		pclustersize = cfg.c_mkfs_pclustersize_packed;
 #ifndef NDEBUG
 	else if (cfg.c_random_pclusterblks)
-		pclusterblks = 1 + rand() % cfg.c_pclusterblks_max;
+		pclustersize = ((1 + rand()) << inode->sbi->blkszbits) %
+				cfg.c_mkfs_pclustersize_max;
 #endif
 	else if (cfg.c_compress_hints_file) {
 		z_erofs_apply_compress_hints(inode);
 		DBG_BUGON(!inode->z_physical_clusterblks);
-		pclusterblks = inode->z_physical_clusterblks;
+		pclustersize = inode->z_physical_clusterblks << inode->sbi->blkszbits;
 	} else {
-		pclusterblks = cfg.c_pclusterblks_def;
+		pclustersize = cfg.c_mkfs_pclustersize_def;
 	}
-	return pclusterblks * erofs_blksiz(inode->sbi);
+	return pclustersize;
 }
 
 static int z_erofs_fill_inline_data(struct erofs_inode *inode, void *data,
@@ -1591,7 +1592,8 @@ static int z_erofs_build_compr_cfgs(struct erofs_sb_info *sbi,
 			.lz4 = {
 				.max_distance =
 					cpu_to_le16(sbi->lz4_max_distance),
-				.max_pclusterblks = cfg.c_pclusterblks_max,
+				.max_pclusterblks =
+					cfg.c_mkfs_pclustersize_max >> sbi->blkszbits,
 			}
 		};
 
@@ -1696,17 +1698,17 @@ int z_erofs_compress_init(struct erofs_sb_info *sbi, struct erofs_buffer_head *s
 	 * if big pcluster is enabled, an extra CBLKCNT lcluster index needs
 	 * to be loaded in order to get those compressed block counts.
 	 */
-	if (cfg.c_pclusterblks_max > 1) {
-		if (cfg.c_pclusterblks_max >
-		    Z_EROFS_PCLUSTER_MAX_SIZE / erofs_blksiz(sbi)) {
-			erofs_err("unsupported clusterblks %u (too large)",
-				  cfg.c_pclusterblks_max);
+	if (cfg.c_mkfs_pclustersize_max > erofs_blksiz(sbi)) {
+		if (cfg.c_mkfs_pclustersize_max > Z_EROFS_PCLUSTER_MAX_SIZE) {
+			erofs_err("unsupported pclustersize %u (too large)",
+				  cfg.c_mkfs_pclustersize_max);
 			return -EINVAL;
 		}
 		erofs_sb_set_big_pcluster(sbi);
 	}
-	if (cfg.c_pclusterblks_packed > cfg.c_pclusterblks_max) {
-		erofs_err("invalid physical cluster size for the packed file");
+	if (cfg.c_mkfs_pclustersize_packed > cfg.c_mkfs_pclustersize_max) {
+		erofs_err("invalid pclustersize for the packed file %u",
+			  cfg.c_mkfs_pclustersize_packed);
 		return -EINVAL;
 	}
 
diff --git a/lib/compress_hints.c b/lib/compress_hints.c
index 8b78f80..e79bd48 100644
--- a/lib/compress_hints.c
+++ b/lib/compress_hints.c
@@ -55,7 +55,7 @@ bool z_erofs_apply_compress_hints(struct erofs_inode *inode)
 		return true;
 
 	s = erofs_fspath(inode->i_srcpath);
-	pclusterblks = cfg.c_pclusterblks_def;
+	pclusterblks = cfg.c_mkfs_pclustersize_def >> inode->sbi->blkszbits;
 	algorithmtype = 0;
 
 	list_for_each_entry(r, &compress_hints_head, list) {
@@ -136,7 +136,7 @@ int erofs_load_compress_hints(struct erofs_sb_info *sbi)
 		if (pclustersize % erofs_blksiz(sbi)) {
 			erofs_warn("invalid physical clustersize %u, "
 				   "use default pclusterblks %u",
-				   pclustersize, cfg.c_pclusterblks_def);
+				   pclustersize, cfg.c_mkfs_pclustersize_def);
 			continue;
 		}
 		erofs_insert_compress_hints(pattern,
@@ -146,9 +146,10 @@ int erofs_load_compress_hints(struct erofs_sb_info *sbi)
 			max_pclustersize = pclustersize;
 	}
 
-	if (cfg.c_pclusterblks_max * erofs_blksiz(sbi) < max_pclustersize) {
-		cfg.c_pclusterblks_max = max_pclustersize / erofs_blksiz(sbi);
-		erofs_warn("update max pclusterblks to %u", cfg.c_pclusterblks_max);
+	if (cfg.c_mkfs_pclustersize_max < max_pclustersize) {
+		cfg.c_mkfs_pclustersize_max = max_pclustersize;
+		erofs_warn("update max pclustersize to %u",
+			   cfg.c_mkfs_pclustersize_max);
 	}
 out:
 	fclose(f);
diff --git a/lib/config.c b/lib/config.c
index 98adaef..26f1c35 100644
--- a/lib/config.c
+++ b/lib/config.c
@@ -35,8 +35,6 @@ void erofs_init_configure(void)
 	cfg.c_unix_timestamp = -1;
 	cfg.c_uid = -1;
 	cfg.c_gid = -1;
-	cfg.c_pclusterblks_max = 1;
-	cfg.c_pclusterblks_def = 1;
 	cfg.c_max_decompressed_extent_bytes = -1;
 	erofs_stdout_tty = isatty(STDOUT_FILENO);
 }
diff --git a/mkfs/main.c b/mkfs/main.c
index 9ad213b..3d19f60 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -820,8 +820,8 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 				  pclustersize_max);
 			return -EINVAL;
 		}
-		cfg.c_pclusterblks_max = pclustersize_max >> sbi.blkszbits;
-		cfg.c_pclusterblks_def = cfg.c_pclusterblks_max;
+		cfg.c_mkfs_pclustersize_max = pclustersize_max;
+		cfg.c_mkfs_pclustersize_def = cfg.c_mkfs_pclustersize_max;
 	}
 	if (cfg.c_chunkbits && cfg.c_chunkbits < sbi.blkszbits) {
 		erofs_err("chunksize %u must be larger than block size",
@@ -830,13 +830,13 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 	}
 
 	if (pclustersize_packed) {
-		if (pclustersize_max < erofs_blksiz(&sbi) ||
-		    pclustersize_max % erofs_blksiz(&sbi)) {
+		if (pclustersize_packed < erofs_blksiz(&sbi) ||
+		    pclustersize_packed % erofs_blksiz(&sbi)) {
 			erofs_err("invalid pcluster size for the packed file %u",
 				  pclustersize_packed);
 			return -EINVAL;
 		}
-		cfg.c_pclusterblks_packed = pclustersize_packed >> sbi.blkszbits;
+		cfg.c_mkfs_pclustersize_packed = pclustersize_packed;
 	}
 	return 0;
 }
@@ -948,6 +948,8 @@ static void erofs_mkfs_default_options(void)
 	cfg.c_legacy_compress = false;
 	cfg.c_inline_data = true;
 	cfg.c_xattr_name_filter = true;
+	cfg.c_mkfs_pclustersize_max = erofs_blksiz(&sbi);
+	cfg.c_mkfs_pclustersize_def = cfg.c_mkfs_pclustersize_max;
 #ifdef EROFS_MT_ENABLED
 	cfg.c_mt_workers = erofs_get_available_processors();
 	cfg.c_mkfs_segment_size = 16ULL * 1024 * 1024;
@@ -1153,8 +1155,8 @@ int main(int argc, char **argv)
 #endif
 	erofs_show_config();
 	if (cfg.c_fragments || cfg.c_extra_ea_name_prefixes) {
-		if (!cfg.c_pclusterblks_packed)
-			cfg.c_pclusterblks_packed = cfg.c_pclusterblks_def;
+		if (!cfg.c_mkfs_pclustersize_packed)
+			cfg.c_mkfs_pclustersize_packed = cfg.c_mkfs_pclustersize_def;
 
 		packedfile = erofs_packedfile_init();
 		if (IS_ERR(packedfile)) {
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] erofs-utils: lib: adjust MicroLZMA default dictionary size
  2024-04-30  6:37 [PATCH 1/2] erofs-utils: record pclustersize in bytes instead of blocks Gao Xiang
@ 2024-04-30  6:37 ` Gao Xiang
  2024-05-01  4:54 ` [PATCH v2 1/2] erofs-utils: record pclustersize in bytes instead of blocks Gao Xiang
  1 sibling, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2024-04-30  6:37 UTC (permalink / raw
  To: linux-erofs; +Cc: Gao Xiang

If dict_size is not given, it will be set as max(32k, pclustersize * 8)
but no more than Z_EROFS_LZMA_MAX_DICT_SIZE.

Also kill an obsolete warning since multi-threaded support is landed.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 lib/compressor_liblzma.c | 19 +++++++++++--------
 mkfs/main.c              |  8 ++++++--
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/lib/compressor_liblzma.c b/lib/compressor_liblzma.c
index 2f19a93..d609a28 100644
--- a/lib/compressor_liblzma.c
+++ b/lib/compressor_liblzma.c
@@ -70,11 +70,18 @@ static int erofs_compressor_liblzma_setlevel(struct erofs_compress *c,
 static int erofs_compressor_liblzma_setdictsize(struct erofs_compress *c,
 						u32 dict_size)
 {
-	if (!dict_size)
-		dict_size = erofs_compressor_lzma.default_dictsize;
+	if (!dict_size) {
+		if (erofs_compressor_lzma.default_dictsize) {
+			dict_size = erofs_compressor_lzma.default_dictsize;
+		} else {
+			dict_size = min_t(u32, Z_EROFS_LZMA_MAX_DICT_SIZE,
+					  cfg.c_mkfs_pclustersize_max << 3);
+			if (dict_size < 32768)
+				dict_size = 32768;
+		}
+	}
 
-	if (dict_size > erofs_compressor_lzma.max_dictsize ||
-	    dict_size < 4096) {
+	if (dict_size > Z_EROFS_LZMA_MAX_DICT_SIZE || dict_size < 4096) {
 		erofs_err("invalid dictionary size %u", dict_size);
 		return -EINVAL;
 	}
@@ -86,7 +93,6 @@ static int erofs_compressor_liblzma_init(struct erofs_compress *c)
 {
 	struct erofs_liblzma_context *ctx;
 	u32 preset;
-	static erofs_atomic_bool_t __warnonce;
 
 	ctx = malloc(sizeof(*ctx));
 	if (!ctx)
@@ -105,15 +111,12 @@ static int erofs_compressor_liblzma_init(struct erofs_compress *c)
 	ctx->opt.dict_size = c->dict_size;
 
 	c->private_data = ctx;
-	if (!erofs_atomic_test_and_set(&__warnonce))
-		erofs_warn("It may take a longer time since MicroLZMA is still single-threaded for now.");
 	return 0;
 }
 
 const struct erofs_compressor erofs_compressor_lzma = {
 	.default_level = LZMA_PRESET_DEFAULT,
 	.best_level = 109,
-	.default_dictsize = Z_EROFS_LZMA_MAX_DICT_SIZE,
 	.max_dictsize = Z_EROFS_LZMA_MAX_DICT_SIZE,
 	.init = erofs_compressor_liblzma_init,
 	.exit = erofs_compressor_liblzma_exit,
diff --git a/mkfs/main.c b/mkfs/main.c
index 3d19f60..bbf4f43 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -137,8 +137,12 @@ static void usage(int argc, char **argv)
 				       spaces, s->c->best_level, s->c->default_level);
 		}
 		if (s->c->setdictsize) {
-			printf("%s  [,dictsize=<dictsize>]\t(default=%u, max=%u)\n",
-			       spaces, s->c->default_dictsize, s->c->max_dictsize);
+			if (s->c->default_dictsize)
+				printf("%s  [,dictsize=<dictsize>]\t(default=%u, max=%u)\n",
+				       spaces, s->c->default_dictsize, s->c->max_dictsize);
+			else
+				printf("%s  [,dictsize=<dictsize>]\t(default=<auto>, max=%u)\n",
+				       spaces, s->c->max_dictsize);
 		}
 	}
 	printf(
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] erofs-utils: record pclustersize in bytes instead of blocks
  2024-04-30  6:37 [PATCH 1/2] erofs-utils: record pclustersize in bytes instead of blocks Gao Xiang
  2024-04-30  6:37 ` [PATCH 2/2] erofs-utils: lib: adjust MicroLZMA default dictionary size Gao Xiang
@ 2024-05-01  4:54 ` Gao Xiang
  1 sibling, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2024-05-01  4:54 UTC (permalink / raw
  To: linux-erofs; +Cc: Gao Xiang

So that we don't need to handle blocksizes everywhere.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
v1:
  fix CI failures:
    https://github.com/erofs/erofsnightly/actions/runs/8896341493/job/24428809079

 include/erofs/config.h |  4 +++-
 lib/compress.c         | 38 +++++++++++++++++++-------------------
 lib/compress_hints.c   | 11 ++++++-----
 lib/config.c           |  2 --
 mkfs/main.c            | 16 +++++++++-------
 5 files changed, 37 insertions(+), 34 deletions(-)

diff --git a/include/erofs/config.h b/include/erofs/config.h
index 16910ea..3ce8c59 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -79,7 +79,9 @@ struct erofs_configure {
 	u64 c_mkfs_segment_size;
 	u32 c_mt_workers;
 #endif
-	u32 c_pclusterblks_max, c_pclusterblks_def, c_pclusterblks_packed;
+	u32 c_mkfs_pclustersize_max;
+	u32 c_mkfs_pclustersize_def;
+	u32 c_mkfs_pclustersize_packed;
 	u32 c_max_decompressed_extent_bytes;
 	u64 c_unix_timestamp;
 	u32 c_uid, c_gid;
diff --git a/lib/compress.c b/lib/compress.c
index f918322..9772543 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -416,22 +416,21 @@ static int write_uncompressed_extent(struct z_erofs_compress_sctx *ctx,
 
 static unsigned int z_erofs_get_max_pclustersize(struct erofs_inode *inode)
 {
-	unsigned int pclusterblks;
-
-	if (erofs_is_packed_inode(inode))
-		pclusterblks = cfg.c_pclusterblks_packed;
+	if (erofs_is_packed_inode(inode)) {
+		return cfg.c_mkfs_pclustersize_packed;
 #ifndef NDEBUG
-	else if (cfg.c_random_pclusterblks)
-		pclusterblks = 1 + rand() % cfg.c_pclusterblks_max;
+	} else if (cfg.c_random_pclusterblks) {
+		unsigned int pclusterblks =
+			cfg.c_mkfs_pclustersize_max >> inode->sbi->blkszbits;
+
+		return (1 + rand() % pclusterblks) << inode->sbi->blkszbits;
 #endif
-	else if (cfg.c_compress_hints_file) {
+	} else if (cfg.c_compress_hints_file) {
 		z_erofs_apply_compress_hints(inode);
 		DBG_BUGON(!inode->z_physical_clusterblks);
-		pclusterblks = inode->z_physical_clusterblks;
-	} else {
-		pclusterblks = cfg.c_pclusterblks_def;
+		return inode->z_physical_clusterblks << inode->sbi->blkszbits;
 	}
-	return pclusterblks * erofs_blksiz(inode->sbi);
+	return cfg.c_mkfs_pclustersize_def;
 }
 
 static int z_erofs_fill_inline_data(struct erofs_inode *inode, void *data,
@@ -1591,7 +1590,8 @@ static int z_erofs_build_compr_cfgs(struct erofs_sb_info *sbi,
 			.lz4 = {
 				.max_distance =
 					cpu_to_le16(sbi->lz4_max_distance),
-				.max_pclusterblks = cfg.c_pclusterblks_max,
+				.max_pclusterblks =
+					cfg.c_mkfs_pclustersize_max >> sbi->blkszbits,
 			}
 		};
 
@@ -1696,17 +1696,17 @@ int z_erofs_compress_init(struct erofs_sb_info *sbi, struct erofs_buffer_head *s
 	 * if big pcluster is enabled, an extra CBLKCNT lcluster index needs
 	 * to be loaded in order to get those compressed block counts.
 	 */
-	if (cfg.c_pclusterblks_max > 1) {
-		if (cfg.c_pclusterblks_max >
-		    Z_EROFS_PCLUSTER_MAX_SIZE / erofs_blksiz(sbi)) {
-			erofs_err("unsupported clusterblks %u (too large)",
-				  cfg.c_pclusterblks_max);
+	if (cfg.c_mkfs_pclustersize_max > erofs_blksiz(sbi)) {
+		if (cfg.c_mkfs_pclustersize_max > Z_EROFS_PCLUSTER_MAX_SIZE) {
+			erofs_err("unsupported pclustersize %u (too large)",
+				  cfg.c_mkfs_pclustersize_max);
 			return -EINVAL;
 		}
 		erofs_sb_set_big_pcluster(sbi);
 	}
-	if (cfg.c_pclusterblks_packed > cfg.c_pclusterblks_max) {
-		erofs_err("invalid physical cluster size for the packed file");
+	if (cfg.c_mkfs_pclustersize_packed > cfg.c_mkfs_pclustersize_max) {
+		erofs_err("invalid pclustersize for the packed file %u",
+			  cfg.c_mkfs_pclustersize_packed);
 		return -EINVAL;
 	}
 
diff --git a/lib/compress_hints.c b/lib/compress_hints.c
index 8b78f80..e79bd48 100644
--- a/lib/compress_hints.c
+++ b/lib/compress_hints.c
@@ -55,7 +55,7 @@ bool z_erofs_apply_compress_hints(struct erofs_inode *inode)
 		return true;
 
 	s = erofs_fspath(inode->i_srcpath);
-	pclusterblks = cfg.c_pclusterblks_def;
+	pclusterblks = cfg.c_mkfs_pclustersize_def >> inode->sbi->blkszbits;
 	algorithmtype = 0;
 
 	list_for_each_entry(r, &compress_hints_head, list) {
@@ -136,7 +136,7 @@ int erofs_load_compress_hints(struct erofs_sb_info *sbi)
 		if (pclustersize % erofs_blksiz(sbi)) {
 			erofs_warn("invalid physical clustersize %u, "
 				   "use default pclusterblks %u",
-				   pclustersize, cfg.c_pclusterblks_def);
+				   pclustersize, cfg.c_mkfs_pclustersize_def);
 			continue;
 		}
 		erofs_insert_compress_hints(pattern,
@@ -146,9 +146,10 @@ int erofs_load_compress_hints(struct erofs_sb_info *sbi)
 			max_pclustersize = pclustersize;
 	}
 
-	if (cfg.c_pclusterblks_max * erofs_blksiz(sbi) < max_pclustersize) {
-		cfg.c_pclusterblks_max = max_pclustersize / erofs_blksiz(sbi);
-		erofs_warn("update max pclusterblks to %u", cfg.c_pclusterblks_max);
+	if (cfg.c_mkfs_pclustersize_max < max_pclustersize) {
+		cfg.c_mkfs_pclustersize_max = max_pclustersize;
+		erofs_warn("update max pclustersize to %u",
+			   cfg.c_mkfs_pclustersize_max);
 	}
 out:
 	fclose(f);
diff --git a/lib/config.c b/lib/config.c
index 98adaef..26f1c35 100644
--- a/lib/config.c
+++ b/lib/config.c
@@ -35,8 +35,6 @@ void erofs_init_configure(void)
 	cfg.c_unix_timestamp = -1;
 	cfg.c_uid = -1;
 	cfg.c_gid = -1;
-	cfg.c_pclusterblks_max = 1;
-	cfg.c_pclusterblks_def = 1;
 	cfg.c_max_decompressed_extent_bytes = -1;
 	erofs_stdout_tty = isatty(STDOUT_FILENO);
 }
diff --git a/mkfs/main.c b/mkfs/main.c
index 9ad213b..a047dfa 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -820,8 +820,8 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 				  pclustersize_max);
 			return -EINVAL;
 		}
-		cfg.c_pclusterblks_max = pclustersize_max >> sbi.blkszbits;
-		cfg.c_pclusterblks_def = cfg.c_pclusterblks_max;
+		cfg.c_mkfs_pclustersize_max = pclustersize_max;
+		cfg.c_mkfs_pclustersize_def = cfg.c_mkfs_pclustersize_max;
 	}
 	if (cfg.c_chunkbits && cfg.c_chunkbits < sbi.blkszbits) {
 		erofs_err("chunksize %u must be larger than block size",
@@ -830,13 +830,13 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 	}
 
 	if (pclustersize_packed) {
-		if (pclustersize_max < erofs_blksiz(&sbi) ||
-		    pclustersize_max % erofs_blksiz(&sbi)) {
+		if (pclustersize_packed < erofs_blksiz(&sbi) ||
+		    pclustersize_packed % erofs_blksiz(&sbi)) {
 			erofs_err("invalid pcluster size for the packed file %u",
 				  pclustersize_packed);
 			return -EINVAL;
 		}
-		cfg.c_pclusterblks_packed = pclustersize_packed >> sbi.blkszbits;
+		cfg.c_mkfs_pclustersize_packed = pclustersize_packed;
 	}
 	return 0;
 }
@@ -953,6 +953,8 @@ static void erofs_mkfs_default_options(void)
 	cfg.c_mkfs_segment_size = 16ULL * 1024 * 1024;
 #endif
 	sbi.blkszbits = ilog2(min_t(u32, getpagesize(), EROFS_MAX_BLOCK_SIZE));
+	cfg.c_mkfs_pclustersize_max = erofs_blksiz(&sbi);
+	cfg.c_mkfs_pclustersize_def = cfg.c_mkfs_pclustersize_max;
 	sbi.feature_incompat = EROFS_FEATURE_INCOMPAT_ZERO_PADDING;
 	sbi.feature_compat = EROFS_FEATURE_COMPAT_SB_CHKSUM |
 			     EROFS_FEATURE_COMPAT_MTIME;
@@ -1153,8 +1155,8 @@ int main(int argc, char **argv)
 #endif
 	erofs_show_config();
 	if (cfg.c_fragments || cfg.c_extra_ea_name_prefixes) {
-		if (!cfg.c_pclusterblks_packed)
-			cfg.c_pclusterblks_packed = cfg.c_pclusterblks_def;
+		if (!cfg.c_mkfs_pclustersize_packed)
+			cfg.c_mkfs_pclustersize_packed = cfg.c_mkfs_pclustersize_def;
 
 		packedfile = erofs_packedfile_init();
 		if (IS_ERR(packedfile)) {
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-01  4:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-30  6:37 [PATCH 1/2] erofs-utils: record pclustersize in bytes instead of blocks Gao Xiang
2024-04-30  6:37 ` [PATCH 2/2] erofs-utils: lib: adjust MicroLZMA default dictionary size Gao Xiang
2024-05-01  4:54 ` [PATCH v2 1/2] erofs-utils: record pclustersize in bytes instead of blocks Gao Xiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.