From e955686d48e66e1a5ca00d66f6e5846ab0c92118 Mon Sep 17 00:00:00 2001 From: Robert Spalek Date: Tue, 9 Nov 2004 17:48:52 +0000 Subject: [PATCH] if SORT_PRESORT and SORT_UP_TO are both on, compute the initial number of runs properly so that we do not run a superfluous pass of sorting --- lib/sorter.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/sorter.h b/lib/sorter.h index 04243318..d8d9dc6d 100644 --- a/lib/sorter.h +++ b/lib/sorter.h @@ -531,11 +531,16 @@ struct fastbuf *fb1, struct fastbuf *fb2 do P(pass)(&fb1, &fb2); while (fb1 && fb2); #else { - sh_off_t run_count = ~1LLU, max_run_count = 0; + sh_off_t run_count, max_run_count = 0; if (fb1) max_run_count += bfilesize(fb1); if (fb2) max_run_count += bfilesize(fb2); +#ifdef SORT_PRESORT + run_count = max_run_count / sorter_presort_bufsize; +#else + run_count = max_run_count; +#endif if (SORT_UP_TO) max_run_count /= SORT_UP_TO; do -- 2.39.2