Skip to contentSkip to conversation

erofs-utils: mkfs: increase the maximum size of the asynchronous queue

PATCH New Gao Xiang 1 participant 1 message Jun 10, 2025 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: mkfs: increase the maximum size of the asynchronous queue

The previous limit of 256 was too small, especially when inflight files are large, causing the job queue to be full while some compression workers remain idle.

Increase the default to 32768 and add the --async-queue-limit option to manually adjust this value.

---
 include/erofs/config.h |  9 +++++----
 lib/inode.c            | 46 +++++++++++++++++++++++-------------------
 mkfs/main.c            | 15 ++++++++++++++
 3 files changed, 45 insertions(+), 25 deletions(-)
include/erofs/config.h +5 -4
index eb5cad8..e4d2bb3 100644
@@ -81,10 +81,6 @@ struct erofs_configure {
 	char c_force_chunkformat;
 	/* < 0, xattr disabled and INT_MAX, always use inline xattrs */
 	int c_inline_xattr_tolerance;
-#ifdef EROFS_MT_ENABLED
-	u64 c_mkfs_segment_size;
-	u32 c_mt_workers;
-#endif
 	u32 c_mkfs_pclustersize_max;
 	u32 c_mkfs_pclustersize_def;
 	u32 c_mkfs_pclustersize_packed;
@@ -94,6 +90,11 @@ struct erofs_configure {
 	const char *mount_point;
 	long long c_uid_offset, c_gid_offset;
 	u32 c_root_xattr_isize;
+#ifdef EROFS_MT_ENABLED
+	u64 c_mkfs_segment_size;
+	u32 c_mt_workers;
+	u32 c_mt_async_queue_limit;
+#endif
 #ifdef WITH_ANDROID
 	char *target_out_path;
 	char *fs_config_file;
lib/inode.c +25 -21

111 lines not on this page · raw message

mkfs/main.c +15 -0
index 8497637..d1b6073 100644
@@ -86,6 +86,9 @@ static struct option long_options[] = {
 	{"sort", required_argument, NULL, 527},
 	{"hard-dereference", no_argument, NULL, 528},
 	{"dsunit", required_argument, NULL, 529},
+#ifdef EROFS_MT_ENABLED
+	{"async-queue-limit", required_argument, NULL, 530},
+#endif
 	{0, 0, 0, 0},
 };
 
@@ -159,6 +162,9 @@ static void usage(int argc, char **argv)
 		"    --mkfs-time        the timestamp is applied as build time only\n"
 		" -UX                   use a given filesystem UUID\n"
 		" --all-root            make all files owned by root\n"
+#ifdef EROFS_MT_ENABLED
+		" --async-queue-limit=# specify the maximum number of entries in the multi-threaded job queue\n"
+#endif
 		" --blobdev=X           specify an extra device X to store chunked data\n"
 		" --chunksize=#         generate chunk-based files with #-byte chunks\n"
 		" --clean=X             run full clean build (default) or:\n"
@@ -905,6 +911,15 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 				return -EINVAL;
 			}
 			break;
+#ifdef EROFS_MT_ENABLED
+		case 530:
+			cfg.c_mt_async_queue_limit = strtoul(optarg, &endptr, 0);
+			if (*endptr != '\0') {
+				erofs_err("invalid async-queue-limit %s", optarg);
+				return -EINVAL;
+			}
+			break;
+#endif
 		case 'V':
 			version();
 			exit(0);
Signature · 1 line
2.43.5