X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Fsyslet-rw.c;h=0fdf75227295540de9defc4976a8b2a84dfb8957;hb=303032ae4e13c7ac10b8198c40df98d95a4524a6;hp=8f2c415d56a4a8aa6d61d2d25e2a279d436b88a3;hpb=e7d2e61694c62b90a2fb84c012b4edcc1973d72c;p=fio.git diff --git a/engines/syslet-rw.c b/engines/syslet-rw.c index 8f2c415d..0fdf7522 100644 --- a/engines/syslet-rw.c +++ b/engines/syslet-rw.c @@ -14,8 +14,7 @@ #include #include "../fio.h" -#include "../indirect.h" -#include "../syslet.h" +#include "../fls.h" #ifdef FIO_HAVE_SYSLET @@ -108,8 +107,10 @@ static int fio_syslet_getevents(struct thread_data *td, unsigned int min, /* * 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; @@ -220,7 +221,6 @@ static void fio_syslet_cleanup(struct thread_data *td) if (sd) { free(sd->events); free(sd->ring); - free(sd->stack); free(sd); td->io_ops->data = NULL; } @@ -242,14 +242,8 @@ static int fio_syslet_init(struct thread_data *td) * 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);