xfs: speed up xfarray sort by sorting xfile page contents directly
authorDarrick J. Wong <djwong@kernel.org>
Thu, 10 Aug 2023 14:48:06 +0000 (07:48 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 10 Aug 2023 14:48:06 +0000 (07:48 -0700)
commite5b46c75892ecd83b49beea08b234a4e496534f8
tree6a61647b49c31f53320dea6e2a5bd6c5248e1374
parent137db333b29186ad085d593c8a702e9f0e9c43f4
xfs: speed up xfarray sort by sorting xfile page contents directly

If all the records in an xfarray subset live within the same memory
page, we can short-circuit even more quicksort recursion by mapping that
page into the local CPU and using the kernel's heapsort function to sort
the subset.  On the author's computer, this reduces the runtime by
another 15% on a 500,000 element array.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Kent Overstreet <kent.overstreet@linux.dev>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/scrub/trace.h
fs/xfs/scrub/xfarray.c
fs/xfs/scrub/xfarray.h