X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fsyslet-rw.c;h=8f2c415d56a4a8aa6d61d2d25e2a279d436b88a3;hp=49bbc712c86a013765e33d0504f758a232667df5;hb=e7d2e61694c62b90a2fb84c012b4edcc1973d72c;hpb=db6defc77508f5bf217f0a6768d13426eee21119 diff --git a/engines/syslet-rw.c b/engines/syslet-rw.c index 49bbc712..8f2c415d 100644 --- a/engines/syslet-rw.c +++ b/engines/syslet-rw.c @@ -75,9 +75,7 @@ static void fio_syslet_wait_for_events(struct thread_data *td) { struct syslet_data *sd = td->io_ops->data; struct syslet_ring *ring = sd->ring; - unsigned int events; - events = 0; do { unsigned int kh = ring->kernel_head; int ret; @@ -89,9 +87,8 @@ static void fio_syslet_wait_for_events(struct thread_data *td) unsigned int nr = kh - ring->user_tail; fio_syslet_add_events(td, nr); - events += nr; ring->user_tail = kh; - continue; + break; } /* @@ -99,25 +96,21 @@ static void fio_syslet_wait_for_events(struct thread_data *td) */ ret = syscall(__NR_syslet_ring_wait, ring, ring->user_tail); assert(!ret); - } while (!events); + } while (1); } -static int fio_syslet_getevents(struct thread_data *td, int min, - int fio_unused max, +static int fio_syslet_getevents(struct thread_data *td, unsigned int min, + unsigned int fio_unused max, struct timespec fio_unused *t) { struct syslet_data *sd = td->io_ops->data; long ret; - do { - /* - * do we have enough immediate completions? - */ - if (sd->nr_events >= (unsigned int) min) - break; - + /* + * While we have less events than requested, block waiting for them + */ + while (sd->nr_events < (unsigned int) min) fio_syslet_wait_for_events(td); - } while (1); ret = sd->nr_events; sd->nr_events = 0;