From 9e9d164e7847aba2ce88bf77f9d1778d15d772e5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 12 Mar 2007 09:37:46 +0100 Subject: [PATCH] If residual count == full count, fail the io We always do blocking io, so regard nothing read/written as an error condition. Signed-off-by: Jens Axboe --- fio.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/fio.c b/fio.c index cc65e3d0..509f8be4 100644 --- a/fio.c +++ b/fio.c @@ -301,9 +301,17 @@ static void do_verify(struct thread_data *td) case FIO_Q_COMPLETED: if (io_u->error) ret = -io_u->error; - else if (io_u->xfer_buflen != io_u->resid && io_u->resid) { + else if (io_u->resid) { int bytes = io_u->xfer_buflen - io_u->resid; + /* + * zero read, fail + */ + if (!bytes) { + td_verror(td, ENODATA, "full resid"); + put_io_u(td, io_u); + break; + } io_u->xfer_buflen = io_u->resid; io_u->xfer_buf += bytes; requeue_io_u(td, &io_u); @@ -399,9 +407,18 @@ static void do_io(struct thread_data *td) case FIO_Q_COMPLETED: if (io_u->error) ret = -io_u->error; - else if (io_u->xfer_buflen != io_u->resid && io_u->resid) { + else if (io_u->resid) { int bytes = io_u->xfer_buflen - io_u->resid; + /* + * zero read, fail + */ + if (!bytes) { + td_verror(td, ENODATA, "full resid"); + put_io_u(td, io_u); + break; + } + io_u->xfer_buflen = io_u->resid; io_u->xfer_buf += bytes; requeue_io_u(td, &io_u); -- 2.25.1