]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
blk/kernel: expose IORING_SETUP_{IOPOLL,SQPOLL} as options 38257/head
authorJiangYu <lnsyyj@hotmail.com>
Tue, 24 Nov 2020 03:19:39 +0000 (03:19 +0000)
committerJiangYu <lnsyyj@hotmail.com>
Tue, 24 Nov 2020 13:40:47 +0000 (13:40 +0000)
Signed-off-by: JiangYu <lnsyyj@hotmail.com>
src/blk/kernel/KernelDevice.cc
src/blk/kernel/io_uring.cc
src/blk/kernel/io_uring.h
src/common/options.cc

index 58142b3c106a6ff24bf5fa88bf90ca7668eaf974..e3ef9f155d80af604142420ca5c217d6bb1d0b5f 100644 (file)
@@ -70,7 +70,9 @@ KernelDevice::KernelDevice(CephContext* cct, aio_callback_t cb, void *cbpriv, ai
   unsigned int iodepth = cct->_conf->bdev_aio_max_queue_depth;
 
   if (use_ioring && ioring_queue_t::supported()) {
-    io_queue = std::make_unique<ioring_queue_t>(iodepth);
+    bool use_ioring_hipri = cct->_conf.get_val<bool>("bdev_ioring_hipri");
+    bool use_ioring_sqthread_poll = cct->_conf.get_val<bool>("bdev_ioring_sqthread_poll");
+    io_queue = std::make_unique<ioring_queue_t>(iodepth, use_ioring_hipri, use_ioring_sqthread_poll);
   } else {
     static bool once;
     if (use_ioring && !once) {
index f248d38197a8af021170be6793aa082185dea814..70fef32bd5c2d3c66edfa78a2620e36ca101ce31 100644 (file)
@@ -8,11 +8,6 @@
 #include "liburing.h"
 #include <sys/epoll.h>
 
-/* Options */
-
-static bool hipri = false;      /* use IO polling */
-static bool sq_thread = false;  /* use kernel submission/poller thread */
-
 struct ioring_data {
   struct io_uring io_uring;
   pthread_mutex_t cq_mutex;
@@ -108,9 +103,11 @@ static void build_fixed_fds_map(struct ioring_data *d,
   }
 }
 
-ioring_queue_t::ioring_queue_t(unsigned iodepth_) :
+ioring_queue_t::ioring_queue_t(unsigned iodepth_, bool hipri_, bool sq_thread_) :
   d(make_unique<ioring_data>()),
-  iodepth(iodepth_)
+  iodepth(iodepth_),
+  hipri(hipri_),
+  sq_thread(sq_thread_)
 {
 }
 
index f4ac2f6e12d8a147bdbdef7496995be339de414c..e7d0acde0134723691c6c28e613660e2ea15a5f6 100644 (file)
@@ -13,13 +13,15 @@ struct ioring_data;
 struct ioring_queue_t final : public io_queue_t {
   std::unique_ptr<ioring_data> d;
   unsigned iodepth = 0;
+  bool hipri = false;
+  bool sq_thread = false;
 
   typedef std::list<aio_t>::iterator aio_iter;
 
   // Returns true if arch is x86-64 and kernel supports io_uring
   static bool supported();
 
-  ioring_queue_t(unsigned iodepth_);
+  ioring_queue_t(unsigned iodepth_, bool hipri_, bool sq_thread_);
   ~ioring_queue_t() final;
 
   int init(std::vector<int> &fds) final;
index 806da4e1215a5f3749a45c77132caef494a18849..7de01868ccfdf6b4f1a3a94e806c73f89731e3ef 100644 (file)
@@ -4791,6 +4791,14 @@ std::vector<Option> get_global_options() {
     .set_default(false)
     .set_description("Enables Linux io_uring API instead of libaio"),
 
+    Option("bdev_ioring_hipri", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(false)
+    .set_description("Enables Linux io_uring API Use polled IO completions"),
+
+    Option("bdev_ioring_sqthread_poll", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(false)
+    .set_description("Enables Linux io_uring API Offload submission/completion to kernel thread"),
+
     // -----------------------------------------
     // kstore