[PATCH] erofs-utils: lib: get rid of pthread_cancel() for workqueue

Gao Xiang hsiangkao at linux.alibaba.com
Wed Dec 11 17:07:20 AEDT 2024


Applied with the following diff:

diff --git a/lib/compress.c b/lib/compress.c
index ce1056b..8446fe4 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -1790,7 +1790,9 @@ int z_erofs_compress_init(struct erofs_sb_info *sbi, struct erofs_buffer_head *s
 					    cfg.c_mt_workers << 2,
 					    z_erofs_mt_wq_tls_alloc,
 					    z_erofs_mt_wq_tls_free);
-		z_erofs_mt_enabled = !ret;
+		if (ret)
+			return ret;
+		z_erofs_mt_enabled = true;
 	}
 	pthread_mutex_init(&g_ictx.mutex, NULL);
 	pthread_cond_init(&g_ictx.cond, NULL);
diff --git a/lib/workqueue.c b/lib/workqueue.c
index 840c204..2d4aa68 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -88,7 +88,7 @@ int erofs_alloc_workqueue(struct erofs_workqueue *wq, unsigned int nworker,
 		return -ENOMEM;
 
 	for (i = 0; i < nworker; i++) {
-		ret = pthread_create(&wq->workers[i], NULL, worker_thread, wq);
+		ret = -pthread_create(&wq->workers[i], NULL, worker_thread, wq);
 		if (ret)
 			break;
 	}


More information about the Linux-erofs mailing list