void BlueStore::_set_alloc_sizes(void)
{
- min_alloc_size_order = ctz(min_alloc_size);
- assert(min_alloc_size == 1u << min_alloc_size_order);
-
max_alloc_size = cct->_conf->bluestore_max_alloc_size;
if (cct->_conf->bluestore_prefer_deferred_size) {
min_alloc_size = cct->_conf->bluestore_min_alloc_size_ssd;
}
}
- _set_alloc_sizes();
{
bufferlist bl;
::encode((uint64_t)min_alloc_size, bl);
uint64_t val;
::decode(val, p);
min_alloc_size = val;
+ min_alloc_size_order = ctz(val);
+ assert(min_alloc_size == 1u << min_alloc_size_order);
} catch (buffer::error& e) {
derr << __func__ << " unable to read min_alloc_size" << dendl;
return -EIO;
dout(20) << __func__ << " will prefer large blob and csum sizes" << dendl;
- auto order = min_alloc_size_order.load();
if (o->onode.expected_write_size) {
- wctx->csum_order = std::max(order,
+ wctx->csum_order = std::max(min_alloc_size_order,
(uint8_t)ctz(o->onode.expected_write_size));
} else {
- wctx->csum_order = order;
+ wctx->csum_order = min_alloc_size_order;
}
if (wctx->compress) {
size_t block_size_order = 0; ///< bits to shift to get block size
uint64_t min_alloc_size = 0; ///< minimum allocation unit (power of 2)
- std::atomic<int> deferred_batch_ops = {0}; ///< deferred batch size
-
///< bits for min_alloc_size
- std::atomic<uint8_t> min_alloc_size_order = {0};
+ uint8_t min_alloc_size_order = 0;
static_assert(std::numeric_limits<uint8_t>::max() >
std::numeric_limits<decltype(min_alloc_size)>::digits,
"not enough bits for min_alloc_size");
- ///< size threshold for forced deferred writes
- std::atomic<uint64_t> prefer_deferred_size = {0};
-
///< maximum allocation unit (power of 2)
std::atomic<uint64_t> max_alloc_size = {0};
+ ///< number threshold for forced deferred writes
+ std::atomic<int> deferred_batch_ops = {0};
+
+ ///< size threshold for forced deferred writes
+ std::atomic<uint64_t> prefer_deferred_size = {0};
+
///< approx cost per io, in bytes
std::atomic<uint64_t> throttle_cost_per_io = {0};
- std::atomic<Compressor::CompressionMode> comp_mode = {Compressor::COMP_NONE}; ///< compression mode
+ std::atomic<Compressor::CompressionMode> comp_mode =
+ {Compressor::COMP_NONE}; ///< compression mode
CompressorRef compressor;
std::atomic<uint64_t> comp_min_blob_size = {0};
std::atomic<uint64_t> comp_max_blob_size = {0};