Flexible I/O Tester development
 help / color / mirror / Atom feed
* [PATCH] Make rbd engine use aio flush
@ 2014-05-21  8:30 Haomai Wang
  2014-05-29 20:14 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Haomai Wang @ 2014-05-21  8:30 UTC (permalink / raw)
  To: fio; +Cc: Haomai Wang

The fio's option "fsync" can make rbd engine issue sync request. In practice,
we would like to use aio_rbd_flush to make it non-block. So it will be more
reliable to use fio to evaluate actual io scene like qemu.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
---
 engines/rbd.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/engines/rbd.c b/engines/rbd.c
index d006123..32ce60c 100644
--- a/engines/rbd.c
+++ b/engines/rbd.c
@@ -195,6 +195,23 @@ static void _fio_rbd_finish_read_aiocb(rbd_completion_t comp, void *data)
 	return;
 }
 
+static void _fio_rbd_finish_sync_aiocb(rbd_completion_t comp, void *data)
+{
+	struct io_u *io_u = (struct io_u *)data;
+	struct fio_rbd_iou *fio_rbd_iou =
+	    (struct fio_rbd_iou *)io_u->engine_data;
+
+	fio_rbd_iou->io_complete = 1;
+
+	/* if sync needs to be verified - we should not release comp here
+	   without fetching the result */
+	rbd_aio_release(comp);
+
+	/* TODO handle error */
+
+	return;
+}
+
 static struct io_u *fio_rbd_event(struct thread_data *td, int event)
 {
 	struct rbd_data *rbd_data = td->io_ops->data;
@@ -281,13 +298,22 @@ static int fio_rbd_queue(struct thread_data *td, struct io_u *io_u)
 		}
 
 	} else if (io_u->ddir == DDIR_SYNC) {
-		r = rbd_flush(rbd_data->image);
+		r = rbd_aio_create_completion(io_u,
+					      (rbd_callback_t)
+					      _fio_rbd_finish_sync_aiocb,
+					      &comp);
+		if (r < 0) {
+			log_err
+			    ("rbd_aio_create_completion for DDIR_SYNC failed.\n");
+			goto failed;
+		}
+
+		r = rbd_aio_flush(rbd_data->image, comp);
 		if (r < 0) {
 			log_err("rbd_flush failed.\n");
 			goto failed;
 		}
 
-		return FIO_Q_COMPLETED;
 	} else {
 		dprint(FD_IO, "%s: Warning: unhandled ddir: %d\n", __func__,
 		       io_u->ddir);
-- 
1.8.5.2 (Apple Git-48)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Make rbd engine use aio flush
  2014-05-21  8:30 [PATCH] Make rbd engine use aio flush Haomai Wang
@ 2014-05-29 20:14 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2014-05-29 20:14 UTC (permalink / raw)
  To: Haomai Wang, fio

On 05/21/2014 02:30 AM, Haomai Wang wrote:
> The fio's option "fsync" can make rbd engine issue sync request. In practice,
> we would like to use aio_rbd_flush to make it non-block. So it will be more
> reliable to use fio to evaluate actual io scene like qemu.

Thanks, added.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-29 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-21  8:30 [PATCH] Make rbd engine use aio flush Haomai Wang
2014-05-29 20:14 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox