Re: [PATCH] erofs-utils: fsck: add concurrent extraction and decompression

Gao Xiang <[email protected]> Thu, 2 Jul 2026 20:54:09 +0800
Newsgroups org.ozlabs.lists.linux-erofs
Message-ID <[email protected]>

On 2026/7/2 16:10, Nithurshen wrote:
> This patch introduces a multi-threaded pipeline for fsck.erofs,
> combining parallel directory traversal with background pcluster
> decompression to significantly reduce extraction time.
> 
> Key architectural changes include:
> 
> - Thread-Safe State: Removes the global dirstack array and
>    fsckcfg.extract_path. These are replaced with per-task localized
>    paths and thread-local linked lists to eliminate data races.
> - Concurrent Traversal: Refactors erofsfsck_dirent_iter to allocate
>    task structures and dispatch inode processing to a background
>    workqueue (z_erofs_mt_wq).
> - Asynchronous Decompression: Introduces z_erofs_mt_read_ctx to
>    batch pcluster reads and decouple decompression from main I/O.
>    Limits batch size dynamically (32 for LZ4, 8 for compute-heavy
>    algorithms) to balance CPU cache hits and memory overhead.
> - Memory & Deadlock Safety: Implements inline backpressure during
>    directory iteration. If pending inodes exceed workqueue capacity,
>    execution falls back to synchronous processing to prevent
>    recursive thread-pool starvation and unbounded memory growth.
> - Synchronization Primitives: Adds portable condition variable
>    wrappers (erofs_cond_t) to ensure the main thread safely waits
>    for all pending background inodes before exiting.
> 
> Signed-off-by: Nithurshen <[email protected]>

What's the relationship with the previous two patches?

Thanks,
Gao Xiang