* Fill in an array of IO completions up to count, if any are available. * Returns the amount of IO completions filled. */
| 225 | * Returns the amount of IO completions filled. |
| 226 | */ |
| 227 | unsigned io_uring_peek_batch_cqe(struct io_uring *ring, |
| 228 | struct io_uring_cqe **cqes, unsigned count) |
| 229 | { |
| 230 | if (io_uring_peek_batch_cqe_(ring, cqes, &count)) |
| 231 | return count; |
| 232 | |
| 233 | if (!cq_ring_needs_flush(ring)) |
| 234 | return 0; |
| 235 | |
| 236 | io_uring_get_events(ring); |
| 237 | if (!io_uring_peek_batch_cqe_(ring, cqes, &count)) |
| 238 | return 0; |
| 239 | |
| 240 | return count; |
| 241 | } |
| 242 | |
| 243 | /* |
| 244 | * Sync internal state with kernel ring state on the SQ side. Returns the |