[PATCH] Move td_verror() into io_ops->queue() hook

Shows where the error occured, not where it got noticed.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/engines/libaio.c b/engines/libaio.c
index 47c1d4b..c2f47d8 100644
--- a/engines/libaio.c
+++ b/engines/libaio.c
@@ -115,6 +115,7 @@
 	if (ret <= 0) {
 		io_u->resid = io_u->xfer_buflen;
 		io_u->error = -ret;
+		td_verror(td, io_u->error);
 		return 1;
 	}
 
diff --git a/engines/mmap.c b/engines/mmap.c
index dc1fd33..b214319 100644
--- a/engines/mmap.c
+++ b/engines/mmap.c
@@ -68,6 +68,8 @@
 
 	if (!io_u->error)
 		sd->last_io_u = io_u;
+	else
+		td_verror(td, io_u->error);
 
 	return io_u->error;
 }
diff --git a/engines/net.c b/engines/net.c
index 8e5ad5e..fe114a7 100644
--- a/engines/net.c
+++ b/engines/net.c
@@ -102,6 +102,8 @@
 
 	if (!io_u->error)
 		nd->last_io_u = io_u;
+	else
+		td_verror(td, io_u->error);
 
 	return io_u->error;
 }
diff --git a/engines/posixaio.c b/engines/posixaio.c
index 71601fd..2fc56cd 100644
--- a/engines/posixaio.c
+++ b/engines/posixaio.c
@@ -151,8 +151,10 @@
 	else
 		ret = aio_fsync(O_SYNC, aiocb);
 
-	if (ret)
+	if (ret) {
 		io_u->error = errno;
+		td_verror(td, io_u->error);
+	}
 		
 	return io_u->error;
 }
diff --git a/engines/sg.c b/engines/sg.c
index d320070..8d086bf 100644
--- a/engines/sg.c
+++ b/engines/sg.c
@@ -261,7 +261,12 @@
 		io_u->error = EIO;
 	}
 
-	return io_u->error;
+	if (io_u->error) {
+		td_verror(td, io_u->error);
+		return io_u->error;
+	}
+
+	return 0;
 }
 
 static struct io_u *fio_sgio_event(struct thread_data *td, int event)
diff --git a/engines/splice.c b/engines/splice.c
index 026a82b..432ba79 100644
--- a/engines/splice.c
+++ b/engines/splice.c
@@ -152,6 +152,8 @@
 
 	if (!io_u->error)
 		sd->last_io_u = io_u;
+	else
+		td_verror(td, io_u->error);
 
 	return io_u->error;
 }
diff --git a/engines/sync.c b/engines/sync.c
index 94dd710..f689cbe 100644
--- a/engines/sync.c
+++ b/engines/sync.c
@@ -80,6 +80,8 @@
 
 	if (!io_u->error)
 		sd->last_io_u = io_u;
+	else
+		td_verror(td, io_u->error);
 
 	return io_u->error;
 }
diff --git a/fio.c b/fio.c
index 9c97033..2aeb6f7 100644
--- a/fio.c
+++ b/fio.c
@@ -412,7 +412,6 @@
 				io_u->xfer_buf += ret;
 				goto requeue;
 			} else {
-				td_verror(td, io_u->error);
 				put_io_u(td, io_u);
 				break;
 			}