Commit aeea7370 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook GitHub Bot

Add support for immediate SQ poll submit

Summary: Add support for immediate SQ poll submit

Reviewed By: kevin-vigor

Differential Revision: D23818098

fbshipit-source-id: d8d626c51aef0cf8c0049e081d86313cb731429a
parent 0f0fe916
......@@ -362,8 +362,7 @@ void IoUringBackend::queueRead(
iocb->backendCb_ = processFileOpCB;
incNumIoCbInUse();
submitList_.push_back(*iocb);
numInsertedEvents_++;
submitImmediateIoCb(*iocb);
}
void IoUringBackend::queueWrite(
......@@ -379,8 +378,7 @@ void IoUringBackend::queueWrite(
iocb->backendCb_ = processFileOpCB;
incNumIoCbInUse();
submitList_.push_back(*iocb);
numInsertedEvents_++;
submitImmediateIoCb(*iocb);
}
void IoUringBackend::queueReadv(
......@@ -392,8 +390,7 @@ void IoUringBackend::queueReadv(
iocb->backendCb_ = processFileOpCB;
incNumIoCbInUse();
submitList_.push_back(*iocb);
numInsertedEvents_++;
submitImmediateIoCb(*iocb);
}
void IoUringBackend::queueWritev(
......@@ -405,8 +402,7 @@ void IoUringBackend::queueWritev(
iocb->backendCb_ = processFileOpCB;
incNumIoCbInUse();
submitList_.push_back(*iocb);
numInsertedEvents_++;
submitImmediateIoCb(*iocb);
}
void IoUringBackend::queueFsync(int fd, FileOpCallback&& cb) {
......@@ -422,8 +418,7 @@ void IoUringBackend::queueFsync(int fd, FSyncFlags flags, FileOpCallback&& cb) {
iocb->backendCb_ = processFileOpCB;
incNumIoCbInUse();
submitList_.push_back(*iocb);
numInsertedEvents_++;
submitImmediateIoCb(*iocb);
}
void IoUringBackend::processFileOp(IoCb* ioCb, int64_t res) noexcept {
......
......@@ -40,6 +40,7 @@ class PollIoBackend : public EventBaseBackendBase {
enum Flags {
POLL_SQ = 0x1,
POLL_CQ = 0x2,
POLL_SQ_IMMEDIATE_IO = 0x4, // do not enqueue I/O operations
};
Options() = default;
......@@ -380,6 +381,21 @@ class PollIoBackend : public EventBaseBackendBase {
virtual size_t submitList(
IoCbList& ioCbs,
WaitForEventsMode waitForEvents) = 0;
// submit immediate if POLL_SQ | POLL_SQ_IMMEDIATE_IO flags are set
void submitImmediateIoCb(IoCb& iocb) {
if (options_.flags &
(Options::Flags::POLL_SQ | Options::Flags::POLL_SQ_IMMEDIATE_IO)) {
IoCbList s;
s.push_back(iocb);
numInsertedEvents_++;
submitList(s, WaitForEventsMode::DONT_WAIT);
} else {
submitList_.push_back(iocb);
numInsertedEvents_++;
}
}
virtual int submitOne(IoCb* ioCb) = 0;
virtual int cancelOne(IoCb* ioCb) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment