From 117868024939609aebd94fff5afacfd29b2f9a6f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 5 Mar 2007 18:33:22 +0100 Subject: [PATCH] Cleanup requeue handling Clear ->resid automatically, and get rid of the goto construct. Signed-off-by: Jens Axboe --- fio.c | 26 +++++++++++++------------- ioengines.c | 3 +++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/fio.c b/fio.c index bf903d92..45ed354b 100644 --- a/fio.c +++ b/fio.c @@ -291,9 +291,8 @@ static void do_verify(struct thread_data *td) } io_u->end_io = verify_io_u; -requeue: - ret = td_io_queue(td, io_u); + ret = td_io_queue(td, io_u); switch (ret) { case FIO_Q_COMPLETED: if (io_u->error) @@ -303,11 +302,12 @@ requeue: io_u->xfer_buflen = io_u->resid; io_u->xfer_buf += bytes; - goto requeue; + requeue_io_u(td, &io_u); + } else { + ret = io_u_sync_complete(td, io_u); + if (ret < 0) + break; } - ret = io_u_sync_complete(td, io_u); - if (ret < 0) - break; continue; case FIO_Q_QUEUED: break; @@ -414,9 +414,8 @@ static void do_io(struct thread_data *td) put_io_u(td, io_u); break; } -requeue: - ret = td_io_queue(td, io_u); + ret = td_io_queue(td, io_u); switch (ret) { case FIO_Q_COMPLETED: if (io_u->error) @@ -426,12 +425,13 @@ requeue: io_u->xfer_buflen = io_u->resid; io_u->xfer_buf += bytes; - goto requeue; + requeue_io_u(td, &io_u); + } else { + fio_gettime(&comp_time, NULL); + bytes_done = io_u_sync_complete(td, io_u); + if (bytes_done < 0) + ret = bytes_done; } - fio_gettime(&comp_time, NULL); - bytes_done = io_u_sync_complete(td, io_u); - if (bytes_done < 0) - ret = bytes_done; break; case FIO_Q_QUEUED: /* diff --git a/ioengines.c b/ioengines.c index a7ccad66..a395da15 100644 --- a/ioengines.c +++ b/ioengines.c @@ -195,6 +195,9 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u) assert((io_u->flags & IO_U_F_FLIGHT) == 0); io_u->flags |= IO_U_F_FLIGHT; + io_u->error = 0; + io_u->resid = 0; + if (td->io_ops->flags & FIO_SYNCIO) { fio_gettime(&io_u->issue_time, NULL); -- 2.25.1