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 <idryomov@gmail.com>
This commit is contained in:
Ilya Dryomov 2023-02-22 19:02:18 +01:00
parent a6b610f9cc
commit b21a379c5b
2 changed files with 18 additions and 2 deletions

View File

@ -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

View 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);
}
}