OPTION(bluestore_cache_size_ssd, OPT_U64)
OPTION(bluestore_cache_meta_ratio, OPT_DOUBLE)
OPTION(bluestore_cache_kv_ratio, OPT_DOUBLE)
-OPTION(bluestore_cache_kv_max, OPT_INT) // limit the maximum amount of cache for the kv store
+OPTION(bluestore_cache_kv_min, OPT_INT)
OPTION(bluestore_kvbackend, OPT_STR)
OPTION(bluestore_allocator, OPT_STR) // stupid | bitmap
OPTION(bluestore_freelist_blocks_per_key, OPT_INT)
.set_description("Default bluestore_cache_size for non-rotational (solid state) media"),
Option("bluestore_cache_meta_ratio", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
- .set_default(.01)
+ .set_default(.99)
+ .add_see_also("bluestore_cache_size")
.set_description("Ratio of bluestore cache to devote to metadata"),
Option("bluestore_cache_kv_ratio", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
- .set_default(.99)
+ .set_default(.01)
+ .add_see_also("bluestore_cache_size")
.set_description("Ratio of bluestore cache to devote to kv database (rocksdb)"),
- Option("bluestore_cache_kv_max", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+ Option("bluestore_cache_kv_min", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(512_M)
- .set_description("Max memory (bytes) to devote to kv database (rocksdb)")
+ .set_description("Minimum memory (bytes) of bluestore_cache_size to devote to kv database (rocksdb)")
+ .add_see_also("bluestore_cache_size")
.set_long_description("A negative value means using bluestore_cache_meta_ratio "
"and bluestore_cache_kv_ratio instead of calculating these ratios using "
- "bluestore_cache_size_* and bluestore_cache_kv_max."),
+ "bluestore_cache_size_* and bluestore_cache_kv_min. If "
+ "bluestore_cache_size is below bluestore_cache_kv_min "
+ "then this option has no effect."),
Option("bluestore_kvbackend", Option::TYPE_STR, Option::LEVEL_DEV)
.set_default("rocksdb")
cache_meta_ratio = cct->_conf->bluestore_cache_meta_ratio;
cache_kv_ratio = cct->_conf->bluestore_cache_kv_ratio;
- double cache_kv_max = cct->_conf->bluestore_cache_kv_max;
- double cache_kv_max_ratio = 0;
-
- // if cache_kv_max is negative, disable it
- if (cache_size > 0 && cache_kv_max >= 0) {
- cache_kv_max_ratio = (double) cache_kv_max / (double) cache_size;
- if (cache_kv_max_ratio < 1.0 && cache_kv_max_ratio < cache_kv_ratio) {
- dout(1) << __func__ << " max " << cache_kv_max_ratio
- << " < ratio " << cache_kv_ratio
- << dendl;
- cache_meta_ratio = cache_meta_ratio + cache_kv_ratio - cache_kv_max_ratio;
- cache_kv_ratio = cache_kv_max_ratio;
- }
- }
-
- cache_data_ratio =
- (double)1.0 - (double)cache_meta_ratio - (double)cache_kv_ratio;
-
if (cache_meta_ratio < 0 || cache_meta_ratio > 1.0) {
derr << __func__ << " bluestore_cache_meta_ratio (" << cache_meta_ratio
<< ") must be in range [0,1.0]" << dendl;
<< dendl;
return -EINVAL;
}
+
+ double cache_kv_min = cct->_conf->bluestore_cache_kv_min;
+ double cache_kv_min_ratio = 0;
+
+ // if cache_kv_min is negative, disable it
+ if (cache_size > 0 && cache_kv_min >= 0) {
+ cache_kv_min_ratio = std::min((double)cache_kv_min / (double)cache_size,
+ (double)1.0);
+ if (cache_kv_min_ratio > cache_kv_ratio) {
+ dout(1) << __func__ << " kv_min_ratio " << cache_kv_min_ratio
+ << " > kv_ratio " << cache_kv_ratio << dendl;
+ cache_kv_ratio = cache_kv_min_ratio;
+ cache_meta_ratio = std::min((double)cache_meta_ratio,
+ (double)1.0 - cache_kv_ratio);
+ }
+ }
+
+ cache_data_ratio =
+ (double)1.0 - (double)cache_meta_ratio - (double)cache_kv_ratio;
+
if (cache_data_ratio < 0) {
// deal with floating point imprecision
cache_data_ratio = 0;