diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-04-20 12:39:17 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-20 12:39:17 +0200 |
commit | cd98801fbed25dcc49f58cf1451af22f0455a6e6 (patch) | |
tree | 135d7444686d0dc1da19faa5a59909050723619e /engines | |
parent | d0a278f3640546d63b4fcecc01074cad0b7f77b3 (diff) | |
download | fio-cd98801fbed25dcc49f58cf1451af22f0455a6e6.tar.gz |
splice engine: fix vmsplice() problem with block sizes larger than a pipe
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'engines')
-rw-r--r-- | engines/splice.c | 11 |
1 files changed, 7 insertions, 4 deletions
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; |