[PATCH] ->queue() error handling
authorJens Axboe <jens.axboe@oracle.com>
Wed, 25 Oct 2006 07:16:07 +0000 (09:16 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 25 Oct 2006 07:16:07 +0000 (09:16 +0200)
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 <jens.axboe@oracle.com>
engines/fio-engine-libaio.c
fio.c

index 5e394e3e477f0961ad65c8f65a619b1151c30ee6..daee65930b956984991ee0fce9482bff0e19310b 100644 (file)
@@ -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 53735c6c8801c3f47568eef3fded46a136e27f2b..8571e65bba99dc4e2e775d00a74161dfcf419748 100644 (file)
--- 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;
                }