X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fio-io.c;h=7b1c1bd3a3360e9feadd4def4eb8c90bd83111aa;hp=f5d48fd25fab2f3e42b69d359a863c462205bf49;hb=1ac267bb7dd678fa12bb3573c29cff5238ef9ccf;hpb=51852280c02ed3a3dbac4346b9dd1ec7cc7ca8ca diff --git a/fio-io.c b/fio-io.c index f5d48fd2..7b1c1bd3 100644 --- a/fio-io.c +++ b/fio-io.c @@ -776,16 +776,25 @@ static int fio_splice_read(struct thread_data *td, struct io_u *io_u) { struct spliceio_data *sd = td->io_data; int ret, ret2, buflen; + off_t offset; void *p; + offset = io_u->offset; buflen = io_u->buflen; p = io_u->buf; while (buflen) { - off_t off = io_u->offset; + int this_len = buflen; + + if (this_len > SPLICE_DEF_SIZE) + this_len = SPLICE_DEF_SIZE; + + ret = splice(td->fd, &offset, sd->pipe[1], NULL, this_len, SPLICE_F_MORE); + if (ret < 0) { + if (errno == ENODATA || errno == EAGAIN) + continue; - ret = splice(td->fd, &off, sd->pipe[1], NULL, buflen, 0); - if (ret < 0) return errno; + } buflen -= ret; @@ -816,6 +825,7 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u) } }; struct pollfd pfd = { .fd = sd->pipe[1], .events = POLLOUT, }; + off_t off = io_u->offset; int ret, ret2; while (iov[0].iov_len) { @@ -830,8 +840,6 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u) iov[0].iov_base += ret; while (ret) { - off_t off = io_u->offset; - ret2 = splice(sd->pipe[0], NULL, td->fd, &off, ret, 0); if (ret2 < 0) return errno;