for (auto& p : txc->ioc.pending_aios) {
ios += p.iov.size();
}
- txc->cost = ios * throttle_cost_per_io + txc->bytes;
+ auto cost = throttle_cost_per_io.load();
+ txc->cost = ios * cost + txc->bytes;
dout(10) << __func__ << " " << txc << " cost " << txc->cost << " ("
- << ios << " ios * " << throttle_cost_per_io << " + " << txc->bytes
+ << ios << " ios * " << cost << " + " << txc->bytes
<< " bytes)" << dendl;
}
AllocExtentVector extents;
extents.reserve(4); // 4 should be (more than) enough for most allocations
- int64_t got = alloc->allocate(final_length, min_alloc_size, max_alloc_size,
- hint, &extents);
+ int64_t got = alloc->allocate(final_length, min_alloc_size,
+ max_alloc_size.load(),
+ hint, &extents);
assert(got == (int64_t)final_length);
need -= got;
txc->statfs_delta.allocated() += got;
// queue io
if (!g_conf->bluestore_debug_omit_block_device_write) {
- if (l->length() <= prefer_deferred_size) {
+ if (l->length() <= prefer_deferred_size.load()) {
dout(20) << __func__ << " deferring small 0x" << std::hex
<< l->length() << std::dec << " write via deferred" << dendl;
bluestore_deferred_op_t *op = _get_deferred_op(txc, o);
CEPH_OSD_ALLOC_HINT_FLAG_APPEND_ONLY)) &&
(alloc_hints & CEPH_OSD_ALLOC_HINT_FLAG_RANDOM_WRITE) == 0) {
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(min_alloc_size_order,
+ wctx.csum_order = std::max(order,
(size_t)ctzl(o->onode.expected_write_size));
} else {
- wctx.csum_order = min_alloc_size_order;
+ wctx.csum_order = 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)
- size_t min_alloc_size_order = 0; ///< bits for min_alloc_size
- uint64_t prefer_deferred_size = 0; ///< size threshold for forced deferred writes
int deferred_batch_ops = 0; ///< deferred batch size
- uint64_t max_alloc_size = 0; ///< maximum allocation unit (power of 2)
+ ///< bits for min_alloc_size
+ std::atomic<size_t> min_alloc_size_order = {0};
+
+ ///< size threshold for forced deferred writes
+ std::atomic<uint64_t> prefer_deferred_size = {0};
- uint64_t throttle_cost_per_io = 0; ///< approx cost per io, in bytes
+ ///< maximum allocation unit (power of 2)
+ std::atomic<uint64_t> max_alloc_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
CompressorRef compressor;