| 84 | } |
| 85 | |
| 86 | static void reinit_ring(struct buf_desc *bd) |
| 87 | { |
| 88 | struct io_uring *ring = &bd->ring; |
| 89 | int ret; |
| 90 | |
| 91 | if (bd->ring_init) { |
| 92 | io_uring_queue_exit(ring); |
| 93 | bd->ring_init = false; |
| 94 | } |
| 95 | |
| 96 | ret = io_uring_queue_init(32, ring, 0); |
| 97 | if (ret) { |
| 98 | fprintf(stderr, "ring init error %i\n", ret); |
| 99 | exit(1); |
| 100 | } |
| 101 | |
| 102 | ret = io_uring_register_buffers_sparse(ring, 128); |
| 103 | if (ret) { |
| 104 | fprintf(stderr, "table reg error %i\n", ret); |
| 105 | exit(1); |
| 106 | } |
| 107 | |
| 108 | bind_ring(bd, &bd->ring, BUF_BASE_IDX); |
| 109 | bd->ring_init = true; |
| 110 | } |
| 111 | |
| 112 | static void init_buffers(struct buf_desc *bd, size_t size) |
| 113 | { |