{
struct spliceio_data *sd = td->io_data;
int ret, ret2, buflen;
+ off_t offset;
void *p;
+ offset = io_u->offset;
buflen = io_u->buflen;
p = io_u->buf;
while (buflen) {
- off_t off = io_u->offset;
+ int this_len = buflen;
+
+ if (this_len > SPLICE_DEF_SIZE)
+ this_len = SPLICE_DEF_SIZE;
+
+ ret = splice(td->fd, &offset, sd->pipe[1], NULL, this_len, SPLICE_F_MORE);
+ if (ret < 0) {
+ if (errno == ENODATA || errno == EAGAIN)
+ continue;
- ret = splice(td->fd, &off, sd->pipe[1], NULL, buflen, 0);
- if (ret < 0)
return errno;
+ }
buflen -= ret;
}
};
struct pollfd pfd = { .fd = sd->pipe[1], .events = POLLOUT, };
+ off_t off = io_u->offset;
int ret, ret2;
while (iov[0].iov_len) {
iov[0].iov_base += ret;
while (ret) {
- off_t off = io_u->offset;
-
ret2 = splice(sd->pipe[0], NULL, td->fd, &off, ret, 0);
if (ret2 < 0)
return errno;
#define SPLICE_F_MORE (0x04) /* expect more data */
#define SPLICE_F_GIFT (0x08) /* pages passed in are a gift */
+#define SPLICE_DEF_SIZE (64*1024)
+
enum {
IOPRIO_WHO_PROCESS = 1,
IOPRIO_WHO_PGRP,