summaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-09-04 15:19:59 +0200
committerJens Axboe <jens.axboe@oracle.com>2007-09-04 15:19:59 +0200
commitbb446c117849b39ece795602774c3716eef6064a (patch)
treed428939b7b85b8203fcd84bb288decf493a490bc /engines
parent061c86982ea02651cab2239b12983dd382019f26 (diff)
downloadfio-bb446c117849b39ece795602774c3716eef6064a.tar.gz
splice engine: add unmapping for vmsplice-to-user
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'engines')
-rw-r--r--engines/splice.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/engines/splice.c b/engines/splice.c
index 9386983c..d8080b42 100644
--- a/engines/splice.c
+++ b/engines/splice.c
@@ -82,6 +82,7 @@ static int fio_splice_read(struct thread_data *td, struct io_u *io_u)
offset = io_u->offset;
buflen = io_u->xfer_buflen;
p = io_u->xfer_buf;
+ io_u->xfer_buf = NULL;
while (buflen) {
int this_len = buflen;
@@ -108,11 +109,14 @@ static int fio_splice_read(struct thread_data *td, struct io_u *io_u)
else if (!ret)
return -ENODATA;
+ if (!io_u->xfer_buf)
+ io_u->xfer_buf = iov.iov_base;
iov.iov_len -= ret;
iov.iov_base += ret;
}
}
+ io_u->unmap = splice_unmap_io_u;
return io_u->xfer_buflen;
}
@@ -155,6 +159,17 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u)
return io_u->xfer_buflen;
}
+static void splice_unmap_io_u(struct thread_data *td, struct io_u *io_u)
+{
+ struct spliceio_data *sd = td->io_ops->data;
+ struct iovec iov = {
+ .iov_base = io_u->xfer_buf,
+ .iov_len = io_u->xfer_buflen,
+ };
+
+ vmsplice(sd->pipe[0], &iov, 1, SPLICE_F_UNMAP);
+}
+
static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u)
{
struct spliceio_data *sd = td->io_ops->data;