summaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-08-14 13:43:05 +0200
committerJens Axboe <jens.axboe@oracle.com>2007-08-14 13:43:05 +0200
commit436885758c1b859392b80c616c338f9cfe9a9dfb (patch)
tree6407a503c21d82cdbec22d73807291e2753e39e7 /engines
parentb753feb720a8f0b1fbb692f915b7878e74e69ae2 (diff)
downloadfio-436885758c1b859392b80c616c338f9cfe9a9dfb.tar.gz
splice: automatically detect whether vmsplice-to-user works
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'engines')
-rw-r--r--engines/splice.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/engines/splice.c b/engines/splice.c
index f54b4414..9386983c 100644
--- a/engines/splice.c
+++ b/engines/splice.c
@@ -116,7 +116,6 @@ static int fio_splice_read(struct thread_data *td, struct io_u *io_u)
return io_u->xfer_buflen;
}
-
/*
* For splice writing, we can vmsplice our data buffer directly into a
* pipe and then splice that to a file.
@@ -162,9 +161,17 @@ static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u)
int ret;
if (io_u->ddir == DDIR_READ) {
- if (sd->vmsplice_to_user)
+ if (sd->vmsplice_to_user) {
ret = fio_splice_read(td, io_u);
- else
+ /*
+ * This kernel doesn't support vmsplice to user
+ * space. Reset the vmsplice_to_user flag, so that
+ * we retry below and don't hit this path again.
+ */
+ if (ret == -EBADF)
+ sd->vmsplice_to_user = 0;
+ }
+ if (!sd->vmsplice_to_user)
ret = fio_splice_read_old(td, io_u);
} else if (io_u->ddir == DDIR_WRITE)
ret = fio_splice_write(td, io_u);
@@ -209,9 +216,9 @@ static int fio_spliceio_init(struct thread_data *td)
}
/*
- * need some check for enabling this, for now just leave it disabled
+ * Assume this work, we'll reset this if it doesn't
*/
- sd->vmsplice_to_user = 0;
+ sd->vmsplice_to_user = 1;
td->io_ops->data = sd;
return 0;