diff options
Diffstat (limited to 'examples/io_uring-cp.c')
-rw-r--r-- | examples/io_uring-cp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/io_uring-cp.c b/examples/io_uring-cp.c index 2a44c30..43444d8 100644 --- a/examples/io_uring-cp.c +++ b/examples/io_uring-cp.c @@ -127,7 +127,8 @@ static int copy_file(struct io_uring *ring, off_t insize) writes = reads = offset = 0; while (insize || write_left) { - int had_reads, got_comp; + unsigned long had_reads; + int got_comp; /* * Queue up as many reads as we can @@ -188,18 +189,20 @@ static int copy_file(struct io_uring *ring, off_t insize) if (cqe->res < 0) { if (cqe->res == -EAGAIN) { queue_prepped(ring, data); + io_uring_submit(ring); io_uring_cqe_seen(ring, cqe); continue; } fprintf(stderr, "cqe failed: %s\n", strerror(-cqe->res)); return 1; - } else if (cqe->res != data->iov.iov_len) { + } else if ((size_t)cqe->res != data->iov.iov_len) { /* Short read/write, adjust and requeue */ data->iov.iov_base += cqe->res; data->iov.iov_len -= cqe->res; data->offset += cqe->res; queue_prepped(ring, data); + io_uring_submit(ring); io_uring_cqe_seen(ring, cqe); continue; } |