[COMMIT seastar master] reactor: pass a plain pointer to io_uring_wait_cqes()

0 views
Skip to first unread message

Commit Bot

<bot@cloudius-systems.com>
unread,
Oct 6, 2022, 6:30:16 AM10/6/22
to seastar-dev@googlegroups.com, Kefu Chai
From: Kefu Chai <tcha...@gmail.com>
Committer: Avi Kivity <a...@scylladb.com>
Branch: master

reactor: pass a plain pointer to io_uring_wait_cqes()

there is no need to have an array of `io_uring_cqe*` on the stack.
as the output parameter of `sqe` will simply point to the start address
of the shared ringbuffer of sq if the `io_uring_wait_cqes()` completes.
we could use it to construct a `std::span<io_uring_cqe>` though.

Signed-off-by: Kefu Chai <tcha...@gmail.com>

---
diff --git a/src/core/reactor_backend.cc b/src/core/reactor_backend.cc
--- a/src/core/reactor_backend.cc
+++ b/src/core/reactor_backend.cc
@@ -1436,9 +1436,9 @@ class reactor_backend_uring final : public reactor_backend {
if (did_work) {
return;
}
- struct ::io_uring_cqe* buf[s_queue_len];
+ struct ::io_uring_cqe* cqe = nullptr;
sigset_t sigs = *active_sigmask; // io_uring_wait_cqes() wants non-const
- auto r = ::io_uring_wait_cqes(&_uring, buf, 1, nullptr, &sigs);
+ auto r = ::io_uring_wait_cqes(&_uring, &cqe, 1, nullptr, &sigs);
if (__builtin_expect(r < 0, false)) {
switch (-r) {
case EINTR:
Reply all
Reply to author
Forward
0 new messages