From 42cd25b794d2a2c04e96a24abea7f773bb7a3c2e Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Tue, 3 Jul 2018 15:11:07 +0800 Subject: [PATCH] os/bluestore: set correctly shard for existed Collection. For existed Collection, the constructor of Collection will be called in _open_collections. But m_finisher_num can't setup when enable bluestore_shard_finishers. So move m_finisher_num setup before _open_collections && _kv_start. Fixes: http://tracker.ceph.com/issues/24761 Signed-off-by: Jianpeng Ma --- src/os/bluestore/BlueStore.cc | 34 +++++++++++++++++++--------------- src/os/bluestore/BlueStore.h | 1 + 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index c73749ded22..3d41252e686 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -3983,6 +3983,23 @@ void BlueStore::_set_blob_size() << std::dec << dendl; } +void BlueStore::_set_finisher_num() +{ + if (cct->_conf->bluestore_shard_finishers) { + if (cct->_conf->osd_op_num_shards) { + m_finisher_num = cct->_conf->osd_op_num_shards; + } else { + assert(bdev); + if (bdev->is_rotational()) { + m_finisher_num = cct->_conf->osd_op_num_shards_hdd; + } else { + m_finisher_num = cct->_conf->osd_op_num_shards_ssd; + } + } + } + assert(m_finisher_num != 0); +} + int BlueStore::_set_cache_sizes() { assert(bdev); @@ -8341,6 +8358,8 @@ int BlueStore::_open_super_meta() _set_compression(); _set_blob_size(); + _set_finisher_num(); + return 0; } @@ -8935,21 +8954,6 @@ void BlueStore::_kv_start() { dout(10) << __func__ << dendl; - if (cct->_conf->bluestore_shard_finishers) { - if (cct->_conf->osd_op_num_shards) { - m_finisher_num = cct->_conf->osd_op_num_shards; - } else { - assert(bdev); - if (bdev->is_rotational()) { - m_finisher_num = cct->_conf->osd_op_num_shards_hdd; - } else { - m_finisher_num = cct->_conf->osd_op_num_shards_ssd; - } - } - } - - assert(m_finisher_num != 0); - for (int i = 0; i < m_finisher_num; ++i) { ostringstream oss; oss << "finisher-" << i; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index d06aea57312..ecc6a9994ac 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -2082,6 +2082,7 @@ private: void _close_fsid(); void _set_alloc_sizes(); void _set_blob_size(); + void _set_finisher_num(); int _open_bdev(bool create); void _close_bdev();