#include <asm/unistd.h>
#include "../fio.h"
-#include "../indirect.h"
-#include "../syslet.h"
+#include "../lib/fls.h"
#ifdef FIO_HAVE_SYSLET
/*
* While we have less events than requested, block waiting for them
+ * (if we have to, there may already be more completed events ready
+ * for us - see fio_syslet_wait_for_events()
*/
- while (sd->nr_events < (unsigned int) min)
+ while (sd->nr_events < min)
fio_syslet_wait_for_events(td);
ret = sd->nr_events;
if (sd) {
free(sd->events);
free(sd->ring);
- free(sd->stack);
free(sd);
- td->io_ops->data = NULL;
}
}
* The ring needs to be a power-of-2, so round it up if we have to
*/
ring_nr = td->o.iodepth;
- if (ring_nr & (ring_nr - 1)) {
- int bits = 1;
-
- while (ring_nr >>= 1)
- bits++;
-
- ring_nr = 1 << bits;
- }
+ if (ring_nr & (ring_nr - 1))
+ ring_nr = 1 << __fls(ring_nr);
ring_size = sizeof(struct syslet_ring) +
ring_nr * sizeof(struct syslet_completion);