Re: [PATCH 2/2] repair/prefetch.c: Create one workqueue with multiple workers

Chandan Babu R
2025-11-06T04:23:01Z

On Tue, Nov 04, 2025 at 08:55:34 AM -0800, Darrick J. Wong wrote:
> On Tue, Nov 04, 2025 at 02:44:37PM +0530, Chandan Babu R wrote:
>> When xfs_repair is executed with a non-zero value for ag_stride,
>> do_inode_prefetch() create multiple workqueues with each of them having just
>> one worker thread.
>>
>> Since commit 12838bda12e669 ("libfrog: fix overly sleep workqueues"), a
>> workqueue can process multiple work items concurrently. Hence, this commit
>> replaces the above logic with just one workqueue having multiple workers.
>>
>> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
>
> Yeah, this also makes sense to me. I wonder if this odd code was some
> sort of workaround for the pre-12838bd workqueue behavior?
>

The old implementation of workqueue which was present in repair/threads.c
would wakeup a worker thread only when inserting a new work item to an empty
work list. So, yes, this most likely is the reason for creating multiple
workqueues.

--
Chandan