| 85 | } |
| 86 | |
| 87 | static int handle_cqe(struct io_uring *ring, struct io_uring_cqe *cqe) |
| 88 | { |
| 89 | struct io_data *data = io_uring_cqe_get_data(cqe); |
| 90 | int ret = 0; |
| 91 | |
| 92 | data->index++; |
| 93 | |
| 94 | if (cqe->res < 0) { |
| 95 | if (cqe->res == -ECANCELED) { |
| 96 | queue_rw_pair(ring, data->iov.iov_len, data->offset); |
| 97 | inflight += 2; |
| 98 | } else { |
| 99 | printf("cqe error: %s\n", strerror(-cqe->res)); |
| 100 | ret = 1; |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | if (data->index == 2) |
| 105 | free(data); |
| 106 | io_uring_cqe_seen(ring, cqe); |
| 107 | return ret; |
| 108 | } |
| 109 | |
| 110 | static int copy_file(struct io_uring *ring, off_t insize) |
| 111 | { |
no test coverage detected