]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: call apply_changes() after setting librados_thread_count 50230/head
authorIlya Dryomov <idryomov@gmail.com>
Wed, 22 Feb 2023 18:02:18 +0000 (19:02 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 23 Feb 2023 11:50:45 +0000 (12:50 +0100)
Otherwise the setting doesn't take effect.  While at it, replace
home-grown stringify() with standard to_string().

Fixes: https://tracker.ceph.com/issues/58833
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
qa/workunits/rbd/rbd-nbd.sh
src/librbd/AsioEngine.cc

index 54b22d846a63307a0ab19cc0d487250a5a7e325f..122df3d6f35a52a47afecbc2b5d36281cfc1d6ff 100755 (executable)
@@ -472,4 +472,19 @@ DEV=
 rbd feature disable ${POOL}/${IMAGE} journaling
 rbd config image rm ${POOL}/${IMAGE} rbd_discard_granularity_bytes
 
+# test that rbd_op_threads setting takes effect
+EXPECTED=`ceph-conf --show-config-value librados_thread_count`
+DEV=`_sudo rbd device --device-type nbd map ${POOL}/${IMAGE}`
+get_pid ${POOL}
+ACTUAL=`ps -p ${PID} -T | grep -c io_context_pool`
+[ ${ACTUAL} -eq ${EXPECTED} ]
+unmap_device ${DEV} ${PID}
+EXPECTED=$((EXPECTED * 3 + 1))
+DEV=`_sudo rbd device --device-type nbd --rbd-op-threads ${EXPECTED} map ${POOL}/${IMAGE}`
+get_pid ${POOL}
+ACTUAL=`ps -p ${PID} -T | grep -c io_context_pool`
+[ ${ACTUAL} -eq ${EXPECTED} ]
+unmap_device ${DEV} ${PID}
+DEV=
+
 echo OK
index 1a46b590479d69fa27a3db2f0266b087f5d2446e..8e2beb49cfd91db696e689aeb280d8cf90086c83 100644 (file)
@@ -3,7 +3,6 @@
 
 #include "librbd/AsioEngine.h"
 #include "include/Context.h"
-#include "include/stringify.h"
 #include "include/neorados/RADOS.hpp"
 #include "include/rados/librados.hpp"
 #include "common/dout.h"
@@ -31,7 +30,9 @@ AsioEngine::AsioEngine(std::shared_ptr<librados::Rados> rados)
   if (rbd_threads > rados_threads) {
     // inherit the librados thread count -- but increase it if librbd wants to
     // utilize more threads
-    m_cct->_conf.set_val("librados_thread_count", stringify(rbd_threads));
+    m_cct->_conf.set_val_or_die("librados_thread_count",
+                                std::to_string(rbd_threads));
+    m_cct->_conf.apply_changes(nullptr);
   }
 }