diff options
author | Darrick J. Wong <[email protected]> | 2023-08-10 07:48:07 -0700 |
---|---|---|
committer | Darrick J. Wong <[email protected]> | 2023-08-10 07:48:07 -0700 |
commit | 764018caa99f7629cefc92257a26b83289a674f3 (patch) | |
tree | e7ff249e79fc61f4e4cad115e4611cf634a9a73b /lib/test_fortify/write_overflow-strncpy-src.c | |
parent | cf36f4f64c2d4e928b6fdfff06d8e21561e3e32f (diff) |
xfs: improve xfarray quicksort pivot
Now that we have the means to do insertion sorts of small in-memory
subsets of an xfarray, use it to improve the quicksort pivot algorithm
by reading 7 records into memory and finding the median of that. This
should prevent bad partitioning when a[lo] and a[hi] end up next to each
other in the final sort, which can happen when sorting for cntbt repair
when the free space is extremely fragmented (e.g. generic/176).
This doesn't speed up the average quicksort run by much, but it will
(hopefully) avoid the quadratic time collapse for which quicksort is
famous.
Signed-off-by: Darrick J. Wong <[email protected]>
Reviewed-by: Kent Overstreet <[email protected]>
Reviewed-by: Dave Chinner <[email protected]>
Diffstat (limited to 'lib/test_fortify/write_overflow-strncpy-src.c')
0 files changed, 0 insertions, 0 deletions