projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
steadystate: kill off ->attained
[fio.git]
/
lib
/
flist_sort.c
diff --git
a/lib/flist_sort.c
b/lib/flist_sort.c
index 9a2da8412593240323df728b99920bfe8a83bc6c..1c91cc457ca97ea091ad2b9287c3379b0e995e66 100644
(file)
--- a/
lib/flist_sort.c
+++ b/
lib/flist_sort.c
@@
-1,14
+1,9
@@
+#include <stdio.h>
#include <string.h>
#include <string.h>
-#include <assert.h>
-
#include "../flist.h"
#include "../flist.h"
-#include "../flist_sort.h"
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
-#endif
+#include "../log.h"
-#define MAX_LIST_LENGTH_BITS
65
+#define MAX_LIST_LENGTH_BITS
20
/*
* Returns a list organized in an intermediate format suited
/*
* Returns a list organized in an intermediate format suited
@@
-74,7
+69,7
@@
static void merge_and_restore_back_links(void *priv,
* element comparison is needed, so the client's cmp()
* routine can invoke cond_resched() periodically.
*/
* element comparison is needed, so the client's cmp()
* routine can invoke cond_resched() periodically.
*/
-
cmp(priv, tail, tail
);
+
(*cmp)(priv, tail->next, tail->next
);
tail->next->prev = tail;
tail = tail->next;
tail->next->prev = tail;
tail = tail->next;
@@
-85,8
+80,8
@@
static void merge_and_restore_back_links(void *priv,
}
/**
}
/**
- *
f
list_sort - sort a list
- * @priv: private data, opaque to
f
list_sort(), passed to @cmp
+ * list_sort - sort a list
+ * @priv: private data, opaque to list_sort(), passed to @cmp
* @head: the list to sort
* @cmp: the elements comparison function
*
* @head: the list to sort
* @cmp: the elements comparison function
*
@@
-126,7
+121,12
@@
void flist_sort(void *priv, struct flist_head *head,
part[lev] = NULL;
}
if (lev > max_lev) {
part[lev] = NULL;
}
if (lev > max_lev) {
- assert(lev < ARRAY_SIZE(part) - 1);
+ if (lev >= MAX_LIST_LENGTH_BITS) {
+ log_err("fio: list passed to"
+ " list_sort() too long for"
+ " efficiency\n");
+ lev--;
+ }
max_lev = lev;
}
part[lev] = cur;
max_lev = lev;
}
part[lev] = cur;