summaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-12-11 08:46:16 +0100
committerJens Axboe <jens.axboe@oracle.com>2007-12-11 08:46:16 +0100
commitc6effc3eb105f74777198ef6ac0f8ea2ba512a9b (patch)
tree36b7b42a1a0241d077d1e7223b752bf9ecf6a6ad /engines
parent05f6a172967321798f63869d330f88a1bc2c8ed9 (diff)
downloadfio-c6effc3eb105f74777198ef6ac0f8ea2ba512a9b.tar.gz
syslet: error handling
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'engines')
-rw-r--r--engines/syslet-rw.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/engines/syslet-rw.c b/engines/syslet-rw.c
index 2e23fc93..e3be4859 100644
--- a/engines/syslet-rw.c
+++ b/engines/syslet-rw.c
@@ -35,7 +35,7 @@ struct syslet_data {
void *stack;
};
-static void fio_syslet_complete(struct thread_data *td, struct io_u *io_u)
+static void fio_syslet_add_event(struct thread_data *td, struct io_u *io_u)
{
struct syslet_data *sd = td->io_ops->data;
@@ -43,7 +43,7 @@ static void fio_syslet_complete(struct thread_data *td, struct io_u *io_u)
sd->events[sd->nr_events++] = io_u;
}
-static void syslet_complete_nr(struct thread_data *td, unsigned int nr)
+static void fio_syslet_add_events(struct thread_data *td, unsigned int nr)
{
struct syslet_data *sd = td->io_ops->data;
unsigned int i;
@@ -52,13 +52,21 @@ static void syslet_complete_nr(struct thread_data *td, unsigned int nr)
unsigned int idx = (i + sd->ring->user_tail) % td->o.iodepth;
struct syslet_completion *comp = &sd->ring->comp[idx];
struct io_u *io_u = (struct io_u *) (long) comp->caller_data;
+ long ret;
+
+ ret = comp->status;
+ if (ret <= 0) {
+ io_u->resid = io_u->xfer_buflen;
+ io_u->error = -ret;
+ } else {
+ io_u->resid = io_u->xfer_buflen - ret;
+ io_u->error = 0;
+ }
- io_u->resid = io_u->xfer_buflen - comp->status;
- fio_syslet_complete(td, io_u);
+ fio_syslet_add_event(td, io_u);
}
}
-
static void fio_syslet_wait_for_events(struct thread_data *td)
{
struct syslet_data *sd = td->io_ops->data;
@@ -76,7 +84,7 @@ static void fio_syslet_wait_for_events(struct thread_data *td)
if (ring->user_tail != kh) {
unsigned int nr = kh - ring->user_tail;
- syslet_complete_nr(td, nr);
+ fio_syslet_add_events(td, nr);
events += nr;
ring->user_tail = kh;
continue;