From: Jens Axboe Date: Wed, 25 Oct 2006 07:16:07 +0000 (+0200) Subject: [PATCH] ->queue() error handling X-Git-Tag: fio-1.8~41 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=353a7e0eb6d80d03016b2ce639f33c554e8546b7;hp=795407caa899ae9b430361ee12543aee41a8e418 [PATCH] ->queue() error handling We return 1/0 for failure/success and put the error in io_u->error. The libaio engine didn't quite do that. Signed-off-by: Jens Axboe --- diff --git a/engines/fio-engine-libaio.c b/engines/fio-engine-libaio.c index 5e394e3e..daee6593 100644 --- a/engines/fio-engine-libaio.c +++ b/engines/fio-engine-libaio.c @@ -78,9 +78,13 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u) break; } while (1); - assert(ret); + if (ret <= 0) { + io_u->resid = io_u->buflen; + io_u->error = -ret; + return 1; + } - return (int) -ret; + return 0; } static int fio_libaio_cancel(struct thread_data *td, struct io_u *io_u) diff --git a/fio.c b/fio.c index 53735c6c..8571e65b 100644 --- a/fio.c +++ b/fio.c @@ -218,14 +218,14 @@ static int fio_io_sync(struct thread_data *td, struct fio_file *f) ret = td_io_queue(td, io_u); if (ret) { + td_verror(td, io_u->error); put_io_u(td, io_u); - td_verror(td, ret); return 1; } ret = td_io_getevents(td, 1, td->cur_depth, NULL); if (ret < 0) { - td_verror(td, -ret); + td_verror(td, ret); return 1; } @@ -292,8 +292,8 @@ void do_verify(struct thread_data *td) ret = td_io_queue(td, io_u); if (ret) { + td_verror(td, io_u->error); put_io_u(td, io_u); - td_verror(td, ret); break; } @@ -399,8 +399,8 @@ static void do_io(struct thread_data *td) ret = td_io_queue(td, io_u); if (ret) { + td_verror(td, io_u->error); put_io_u(td, io_u); - td_verror(td, ret); break; }