splice engine: return negative for error
authorJens Axboe <jens.axboe@oracle.com>
Mon, 2 Apr 2007 08:36:59 +0000 (10:36 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 2 Apr 2007 08:36:59 +0000 (10:36 +0200)
Otherwise fio_splice_queue() will think it has handle errno number
of bytes.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
engines/splice.c

index 59bf7e4f8ed19660d694a4ebf3de0718d27fe583..6d843538fb73bc01b0ee3e0f58701933fbddac3a 100644 (file)
@@ -48,7 +48,7 @@ static int fio_splice_read(struct thread_data *td, struct io_u *io_u)
                        if (errno == ENODATA || errno == EAGAIN)
                                continue;
 
                        if (errno == ENODATA || errno == EAGAIN)
                                continue;
 
-                       return errno;
+                       return -errno;
                }
 
                buflen -= ret;
                }
 
                buflen -= ret;
@@ -56,7 +56,7 @@ static int fio_splice_read(struct thread_data *td, struct io_u *io_u)
                while (ret) {
                        ret2 = read(sd->pipe[0], p, ret);
                        if (ret2 < 0)
                while (ret) {
                        ret2 = read(sd->pipe[0], p, ret);
                        if (ret2 < 0)
-                               return errno;
+                               return -errno;
 
                        ret -= ret2;
                        p += ret2;
 
                        ret -= ret2;
                        p += ret2;
@@ -90,7 +90,7 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u)
 
                ret = vmsplice(sd->pipe[1], iov, 1, SPLICE_F_NONBLOCK);
                if (ret < 0)
 
                ret = vmsplice(sd->pipe[1], iov, 1, SPLICE_F_NONBLOCK);
                if (ret < 0)
-                       return errno;
+                       return -errno;
 
                iov[0].iov_len -= ret;
                iov[0].iov_base += ret;
 
                iov[0].iov_len -= ret;
                iov[0].iov_base += ret;
@@ -98,7 +98,7 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u)
                while (ret) {
                        ret2 = splice(sd->pipe[0], NULL, f->fd, &off, ret, 0);
                        if (ret2 < 0)
                while (ret) {
                        ret2 = splice(sd->pipe[0], NULL, f->fd, &off, ret, 0);
                        if (ret2 < 0)
-                               return errno;
+                               return -errno;
 
                        ret -= ret2;
                }
 
                        ret -= ret2;
                }