From b8ecbef62d45629aae98061903879f4e65cd7cfe Mon Sep 17 00:00:00 2001 From: Ketor Meng Date: Wed, 29 Oct 2014 15:57:02 +0000 Subject: [PATCH] use io_complete var to avoid the rbd_aio_is_complete lock and context switch Signed-off-by: Ketor Meng --- engines/rbd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/rbd.c b/engines/rbd.c index 363be65b..52fc8c9f 100644 --- a/engines/rbd.c +++ b/engines/rbd.c @@ -13,6 +13,7 @@ struct fio_rbd_iou { struct io_u *io_u; rbd_completion_t completion; int io_seen; + int io_complete; }; struct rbd_data { @@ -186,6 +187,8 @@ static void _fio_rbd_finish_aiocb(rbd_completion_t comp, void *data) * a specific error. So we have to assume that it can't do * partial completions. */ + fri->io_complete = 1; + ret = rbd_aio_get_return_value(fri->completion); if (ret < 0) { io_u->error = ret; @@ -207,7 +210,7 @@ static inline int fri_check_complete(struct rbd_data *rbd_data, { struct fio_rbd_iou *fri = io_u->engine_data; - if (rbd_aio_is_complete(fri->completion)) { + if (fri->io_complete) { fri->io_seen = 1; rbd_data->aio_events[*events] = io_u; (*events)++; @@ -283,6 +286,7 @@ static int fio_rbd_queue(struct thread_data *td, struct io_u *io_u) fio_ro_check(td, io_u); fri->io_seen = 0; + fri->io_complete = 0; r = rbd_aio_create_completion(fri, _fio_rbd_finish_aiocb, &fri->completion); -- 2.25.1