*/
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.
"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;
_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") ||
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()
{
_set_csum();
_set_compression();
+ _set_blob_size();
mounted = true;
return 0;
);
}
}
- 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
std::atomic<uint64_t> comp_min_blob_size = {0};
std::atomic<uint64_t> comp_max_blob_size = {0};
+ std::atomic<uint64_t> 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
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);
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");
}
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) {
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