From: Jens Axboe Date: Mon, 20 Apr 2009 10:39:17 +0000 (+0200) Subject: splice engine: fix vmsplice() problem with block sizes larger than a pipe X-Git-Tag: fio-1.26~6 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=cd98801fbed25dcc49f58cf1451af22f0455a6e6 splice engine: fix vmsplice() problem with block sizes larger than a pipe Signed-off-by: Jens Axboe --- diff --git a/engines/splice.c b/engines/splice.c index 26c5c9ad..28e1fb04 100644 --- a/engines/splice.c +++ b/engines/splice.c @@ -81,7 +81,6 @@ static int fio_splice_read(struct thread_data *td, struct io_u *io_u) off_t offset; void *p, *map; -restart: ret = 0; offset = io_u->offset; mmap_len = buflen = io_u->xfer_buflen; @@ -120,15 +119,18 @@ restart: buflen -= ret; iov.iov_base = p; iov.iov_len = ret; - p += ret; while (iov.iov_len) { ret = vmsplice(sd->pipe[0], &iov, 1, SPLICE_F_MOVE); if (ret < 0) { - if (errno == EFAULT && sd->vmsplice_to_user_map) { + if (errno == EFAULT && + sd->vmsplice_to_user_map) { sd->vmsplice_to_user_map = 0; munmap(map, mmap_len); - goto restart; + map = NULL; + p = io_u->xfer_buf; + iov.iov_base = p; + continue; } if (errno == EBADF) { ret = -EBADF; @@ -144,6 +146,7 @@ restart: iov.iov_len -= ret; iov.iov_base += ret; + p += ret; } if (ret < 0) break;