From: Ilya Dryomov Date: Wed, 22 Feb 2023 18:02:18 +0000 (+0100) Subject: librbd: call apply_changes() after setting librados_thread_count X-Git-Tag: v18.1.0~285^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b21a379c5b5af774c738c8c38ae459dba3512e1b;p=ceph.git librbd: call apply_changes() after setting librados_thread_count 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 --- diff --git a/qa/workunits/rbd/rbd-nbd.sh b/qa/workunits/rbd/rbd-nbd.sh index 54b22d846a633..122df3d6f35a5 100755 --- a/qa/workunits/rbd/rbd-nbd.sh +++ b/qa/workunits/rbd/rbd-nbd.sh @@ -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 diff --git a/src/librbd/AsioEngine.cc b/src/librbd/AsioEngine.cc index 1a46b590479d6..8e2beb49cfd91 100644 --- a/src/librbd/AsioEngine.cc +++ b/src/librbd/AsioEngine.cc @@ -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 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); } }