+ while (len) {
+ int ret = splice(f->fd, NULL, nd->pipes[1], NULL, len, 0);
+
+ if (ret < 0) {
+ if (!bytes)
+ bytes = ret;
+
+ break;
+ } else if (!ret)
+ break;
+
+ bytes += ret;
+ len -= ret;
+ }
+
+ return bytes;
+}
+
+/*
+ * Transmit 'len' bytes from the internal pipe
+ */
+static int splice_out(struct thread_data *td, struct io_u *io_u,
+ unsigned int len)
+{
+ struct netio_data *nd = td->io_ops->data;
+ struct fio_file *f = io_u->file;
+ int bytes = 0;
+
+ while (len) {
+ int ret = splice(nd->pipes[0], NULL, f->fd, NULL, len, 0);
+
+ if (ret < 0) {
+ if (!bytes)
+ bytes = ret;
+
+ break;
+ } else if (!ret)
+ break;
+
+ bytes += ret;
+ len -= ret;
+ }
+
+ return bytes;
+}
+
+/*
+ * vmsplice() pipe to io_u buffer
+ */
+static int vmsplice_io_u_out(struct thread_data *td, struct io_u *io_u,
+ unsigned int len)
+{
+ struct netio_data *nd = td->io_ops->data;
+ struct iovec iov = {
+ .iov_base = io_u->xfer_buf,
+ .iov_len = len,
+ };
+ int bytes = 0;
+
+ while (iov.iov_len) {
+ int ret = vmsplice(nd->pipes[0], &iov, 1, SPLICE_F_MOVE);
+
+ if (ret < 0) {
+ if (!bytes)
+ bytes = ret;
+ break;
+ } else if (!ret)
+ break;
+
+ iov.iov_len -= ret;
+ bytes += ret;
+ if (iov.iov_len)
+ iov.iov_base += ret;
+ }
+
+ return bytes;
+}
+
+/*
+ * vmsplice() io_u to pipe
+ */
+static int vmsplice_io_u_in(struct thread_data *td, struct io_u *io_u)
+{
+ struct netio_data *nd = td->io_ops->data;
+ struct iovec iov = {
+ .iov_base = io_u->xfer_buf,
+ .iov_len = io_u->xfer_buflen,
+ };
+ unsigned int bytes = 0;
+
+ while (iov.iov_len) {
+ int ret = vmsplice(nd->pipes[1], &iov, 1, SPLICE_F_MOVE);
+
+ if (ret < 0)
+ return -1;
+ else if (!ret)
+ return bytes;
+
+ iov.iov_len -= ret;
+ bytes += ret;
+ if (iov.iov_len)
+ iov.iov_base += ret;
+ }
+
+ return bytes;
+}
+
+static int fio_netio_splice_in(struct thread_data *td, struct io_u *io_u)
+{
+ int ret;
+
+ ret = splice_in(td, io_u);
+ if (ret <= 0)
+ return ret;
+
+ return vmsplice_io_u_out(td, io_u, ret);
+}
+
+static int fio_netio_splice_out(struct thread_data *td, struct io_u *io_u)
+{
+ int ret;