Hi all, Dave Chinner introduced a patch to the userspace workqueues that allows for controlling the maximum queue depth as part of phase6 cleanups for xfs_repair. This enables us to fix a problem in xfs_scrub wherein we fail to parallelize inode scans to the maximum extent possible if a filesystem's inode usage isn't evenly balanced across AGs. Resolve this problem by using two workqueues for the inode scan -- one that calls INUMBERS to find all the inobt records for the filesystem and creates separate work items for each record; and a second workqueue to turn the inobt records into BULKSTAT calls to do the actual scanning. We use the queue depth control to avoid excessive queuing of inode chunks. This creates more threads to manage, but it means that we avoid the problem of one AG's inode scan continuing on long after the other threads ran out of work. If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below. This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome. --D xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=scrub-iscan-rebalance --- libfrog/workqueue.c | 42 ++++++ libfrog/workqueue.h | 4 + scrub/inodes.c | 335 ++++++++++++++++++++++++++++++++++++++------------- scrub/scrub.c | 30 +++++ scrub/xfs_scrub.c | 1 scrub/xfs_scrub.h | 3 6 files changed, 324 insertions(+), 91 deletions(-)