Skip to contentSkip to conversation

erofs-utils: enable multi-threaded support for `-Eall-fragments`

PATCH In review Gao Xiang 2 participants 2 messages Aug 7, 2024 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: enable multi-threaded support for `-Eall-fragments`

Since -Eall-fragments packs the whole data into the special inode, it's possible to use the multi-threaded compression for this.

Some users may be interested in -Eall-fragments for extreme compression anyway.

---
 lib/compress.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
lib/compress.c +3 -2
index cea96f4..8655e78 100644
@@ -1763,7 +1763,8 @@ int z_erofs_compress_init(struct erofs_sb_info *sbi, struct erofs_buffer_head *s
 
 	z_erofs_mt_enabled = false;
 #ifdef EROFS_MT_ENABLED
-	if (cfg.c_mt_workers > 1 && (cfg.c_dedupe || cfg.c_fragments)) {
+	if (cfg.c_mt_workers >= 1 && (cfg.c_dedupe ||
+				      (cfg.c_fragments && !cfg.c_all_fragments))) {
 		if (cfg.c_dedupe)
 			erofs_warn("multi-threaded dedupe is NOT implemented for now");
 		if (cfg.c_fragments)
@@ -1771,7 +1772,7 @@ int z_erofs_compress_init(struct erofs_sb_info *sbi, struct erofs_buffer_head *s
 		cfg.c_mt_workers = 0;
 	}
 
-	if (cfg.c_mt_workers > 1) {
+	if (cfg.c_mt_workers >= 1) {
 		ret = erofs_alloc_workqueue(&z_erofs_mt_ctrl.wq,
 					    cfg.c_mt_workers,
 					    cfg.c_mt_workers << 2,
Signature · 1 line
2.43.5