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 --- scrub/inodes.c | 343 ++++++++++++++++++++++++++++++++++++++++++-------------- scrub/phase3.c | 44 ++++++- scrub/phase4.c | 6 - scrub/repair.c | 2 scrub/repair.h | 4 - 5 files changed, 300 insertions(+), 99 deletions(-)