From 26577d1301aaa235a273c0b67133eac41661254c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 23 Mar 2023 12:01:35 +0100 Subject: [PATCH] io/uring/Queue: make Submit() virtual, Push() not This allows submitting io_uring calls without an `Operation` instance (fire & forget). We'll do that for close(). --- src/event/UringManager.cxx | 2 +- src/event/UringManager.hxx | 4 +--- src/io/uring/Queue.cxx | 2 +- src/io/uring/Queue.hxx | 6 +++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/event/UringManager.cxx b/src/event/UringManager.cxx index 9c2e334d0..4458e7690 100644 --- a/src/event/UringManager.cxx +++ b/src/event/UringManager.cxx @@ -20,7 +20,7 @@ void Manager::OnIdle() noexcept { try { - Submit(); + Queue::Submit(); } catch (...) { PrintException(std::current_exception()); } diff --git a/src/event/UringManager.hxx b/src/event/UringManager.hxx index cc0417f62..40ea23025 100644 --- a/src/event/UringManager.hxx +++ b/src/event/UringManager.hxx @@ -23,9 +23,7 @@ public: event.ScheduleRead(); } - void Push(struct io_uring_sqe &sqe, - Operation &operation) noexcept override { - AddPending(sqe, operation); + void Submit() override { idle_event.Schedule(); } diff --git a/src/io/uring/Queue.cxx b/src/io/uring/Queue.cxx index ce5239eeb..3c45c03ce 100644 --- a/src/io/uring/Queue.cxx +++ b/src/io/uring/Queue.cxx @@ -27,7 +27,7 @@ Queue::RequireSubmitEntry() if (sqe == nullptr) { /* the submit queue is full; submit it to the kernel and try again */ - Submit(); + ring.Submit(); sqe = GetSubmitEntry(); if (sqe == nullptr) diff --git a/src/io/uring/Queue.hxx b/src/io/uring/Queue.hxx index 6d8fb4d4e..5cda49f1b 100644 --- a/src/io/uring/Queue.hxx +++ b/src/io/uring/Queue.hxx @@ -52,13 +52,13 @@ protected: Operation &operation) noexcept; public: - virtual void Push(struct io_uring_sqe &sqe, - Operation &operation) noexcept { + void Push(struct io_uring_sqe &sqe, + Operation &operation) noexcept { AddPending(sqe, operation); Submit(); } - void Submit() { + virtual void Submit() { ring.Submit(); }