From: Igor Fedotov Date: Mon, 10 Apr 2017 13:01:18 +0000 (+0000) Subject: os/bluestore: make bluestore_max_blob_size parameter hdd/ssd dependant. X-Git-Tag: v12.0.3~324^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f826f0c6ad0140d6b469f83cd4f968c11cd4b237;p=ceph.git os/bluestore: make bluestore_max_blob_size parameter hdd/ssd dependant. Signed-off-by: Igor Fedotov --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 001ac55a9426..e2a104cbdcff 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -1079,7 +1079,9 @@ OPTION(bluestore_gc_enable_blob_threshold, OPT_INT, 0) */ OPTION(bluestore_gc_enable_total_threshold, OPT_INT, 0) -OPTION(bluestore_max_blob_size, OPT_U32, 512*1024) +OPTION(bluestore_max_blob_size, OPT_U32, 0) +OPTION(bluestore_max_blob_size_hdd, OPT_U32, 512*1024) +OPTION(bluestore_max_blob_size_ssd, OPT_U32, 64*1024) /* * Require the net gain of compression at least to be at this ratio, * otherwise we don't compress. diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 246db5bc0b0e..95db56acced7 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -3263,6 +3263,9 @@ const char **BlueStore::get_tracked_conf_keys() const "bluestore_max_bytes", "bluestore_deferred_max_ops", "bluestore_deferred_max_bytes", + "bluestore_max_blob_size", + "bluestore_max_blob_size_ssd", + "bluestore_max_blob_size_hdd", NULL }; return KEYS; @@ -3282,6 +3285,14 @@ void BlueStore::handle_conf_change(const struct md_config_t *conf, _set_compression(); } } + if (changed.count("bluestore_max_blob_size") || + changed.count("bluestore_max_blob_size_ssd") || + changed.count("bluestore_max_blob_size_hdd")) { + if (bdev) { + // only after startup + _set_blob_size(); + } + } if (changed.count("bluestore_prefer_deferred_size") || changed.count("bluestore_max_alloc_size") || changed.count("bluestore_deferred_batch_ops") || @@ -3389,6 +3400,21 @@ void BlueStore::_set_throttle_params() dout(10) << __func__ << " throttle_cost_per_io " << throttle_cost_per_io << dendl; } +void BlueStore::_set_blob_size() +{ + if (cct->_conf->bluestore_max_blob_size) { + max_blob_size = cct->_conf->bluestore_max_blob_size; + } else { + assert(bdev); + if (bdev->is_rotational()) { + max_blob_size = cct->_conf->bluestore_max_blob_size_hdd; + } else { + max_blob_size = cct->_conf->bluestore_max_blob_size_ssd; + } + } + dout(10) << __func__ << " max_blob_size 0x" << std::hex << max_blob_size + << std::dec << dendl; +} void BlueStore::_init_logger() { @@ -4875,6 +4901,7 @@ int BlueStore::mount() _set_csum(); _set_compression(); + _set_blob_size(); mounted = true; return 0; @@ -9613,9 +9640,9 @@ int BlueStore::_do_write( ); } } - if (wctx.target_blob_size == 0 || - wctx.target_blob_size > cct->_conf->bluestore_max_blob_size) { - wctx.target_blob_size = cct->_conf->bluestore_max_blob_size; + uint64_t max_bsize = max_blob_size.load(); + if (wctx.target_blob_size == 0 || wctx.target_blob_size > max_bsize) { + wctx.target_blob_size = max_bsize; } // set the min blob size floor at 2x the min_alloc_size, or else we // won't be able to allocate a smaller extent for the compressed diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 0f79784f061e..00e79b9902d3 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1803,6 +1803,8 @@ private: std::atomic comp_min_blob_size = {0}; std::atomic comp_max_blob_size = {0}; + std::atomic max_blob_size = {0}; ///< maximum blob size + // cache trim control // note that these update in a racy way, but we don't *really* care if @@ -1856,6 +1858,8 @@ private: int _write_fsid(); void _close_fsid(); void _set_alloc_sizes(); + void _set_blob_size(); + int _open_bdev(bool create); void _close_bdev(); int _open_db(bool create); diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 98e4438093cf..a278866619e4 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -5988,7 +5988,7 @@ TEST_P(StoreTestSpecificAUSize, BlobReuseOnOverwrite) { r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } - g_conf->set_val("bluestore_max_blob_size", "524288"); + g_conf->set_val("bluestore_max_blob_size", "0"); } @@ -6171,7 +6171,7 @@ TEST_P(StoreTestSpecificAUSize, BlobReuseOnOverwriteReverse) { r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } - g_conf->set_val("bluestore_max_blob_size", "524288"); + g_conf->set_val("bluestore_max_blob_size", "0"); } TEST_P(StoreTestSpecificAUSize, BlobReuseOnSmallOverwrite) { @@ -6245,7 +6245,7 @@ TEST_P(StoreTestSpecificAUSize, BlobReuseOnSmallOverwrite) { r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } - g_conf->set_val("bluestore_max_blob_size", "524288"); + g_conf->set_val("bluestore_max_blob_size", "0"); } // The test case to reproduce an issue when write happens