From: Jens Axboe Date: Tue, 24 Oct 2006 17:38:15 +0000 (+0200) Subject: [PATCH] Make ->buflen == 0 on SYNC io_u's X-Git-Tag: fio-1.8~43 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=6040dabcaaf29ecea9c68735a4d3a6ad6411f573 [PATCH] Make ->buflen == 0 on SYNC io_u's It eases the error handling in the splice and sync io engine. Signed-off-by: Jens Axboe --- diff --git a/engines/fio-engine-splice.c b/engines/fio-engine-splice.c index 3553d646..192fbd00 100644 --- a/engines/fio-engine-splice.c +++ b/engines/fio-engine-splice.c @@ -129,7 +129,7 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u) static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u) { struct spliceio_data *sd = td->io_ops->data; - int ret; + unsigned int ret; if (io_u->ddir == DDIR_READ) ret = fio_splice_read(td, io_u); @@ -138,7 +138,7 @@ static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u) else ret = fsync(io_u->file->fd); - if ((unsigned int) ret != io_u->buflen) { + if (ret != io_u->buflen) { if (ret > 0) { io_u->resid = io_u->buflen - ret; io_u->error = ENODATA; diff --git a/engines/fio-engine-sync.c b/engines/fio-engine-sync.c index 8bc990d7..43f42ca2 100644 --- a/engines/fio-engine-sync.c +++ b/engines/fio-engine-sync.c @@ -57,7 +57,7 @@ static int fio_syncio_queue(struct thread_data *td, struct io_u *io_u) { struct syncio_data *sd = td->io_ops->data; struct fio_file *f = io_u->file; - int ret; + unsigned int ret; if (io_u->ddir == DDIR_READ) ret = read(f->fd, io_u->buf, io_u->buflen); @@ -66,7 +66,7 @@ static int fio_syncio_queue(struct thread_data *td, struct io_u *io_u) else ret = fsync(f->fd); - if ((unsigned int) ret != io_u->buflen) { + if (ret != io_u->buflen) { if (ret > 0) { io_u->resid = io_u->buflen - ret; io_u->error = EIO; diff --git a/io_u.c b/io_u.c index 738f3e20..45e8bb81 100644 --- a/io_u.c +++ b/io_u.c @@ -229,6 +229,7 @@ struct io_u *__get_io_u(struct thread_data *td) if (!queue_full(td)) { io_u = list_entry(td->io_u_freelist.next, struct io_u, list); + io_u->buflen = 0; io_u->error = 0; io_u->resid = 0; list_del(&io_u->list);