kv_queue_unsubmitted.push_back(txc);
++txc->osr->kv_committing_serially;
}
+ if (txc->had_ios)
+ kv_ios++;
+ kv_throttle_costs += txc->cost;
}
return;
case TransContext::STATE_KV_SUBMITTED:
} else {
deque<TransContext*> kv_submitting;
deque<DeferredBatch*> deferred_done, deferred_stable;
+ uint64_t aios = 0, costs = 0;
+
dout(20) << __func__ << " committing " << kv_queue.size()
<< " submitting " << kv_queue_unsubmitted.size()
<< " deferred done " << deferred_done_queue.size()
kv_submitting.swap(kv_queue_unsubmitted);
deferred_done.swap(deferred_done_queue);
deferred_stable.swap(deferred_stable_queue);
+ aios = kv_ios;
+ costs = kv_throttle_costs;
+ kv_ios = 0;
+ kv_throttle_costs = 0;
utime_t start = ceph_clock_now();
l.unlock();
dout(30) << __func__ << " deferred_done " << deferred_done << dendl;
dout(30) << __func__ << " deferred_stable " << deferred_stable << dendl;
- int num_aios = 0;
- uint64_t total_cost = 0;
- for (auto txc : kv_committing) {
- if (txc->had_ios) {
- ++num_aios;
- }
- total_cost += txc->cost;
- }
-
bool force_flush = false;
// if bluefs is sharing the same device as data (only), then we
// can rely on the bluefs commit to flush the device and make
// deferred aios stable. that means that if we do have done deferred
// txcs AND we are not on a single device, we need to force a flush.
if (bluefs_single_shared_device && bluefs) {
- if (num_aios) {
+ if (aios) {
force_flush = true;
} else if (kv_committing.empty() && kv_submitting.empty() &&
deferred_stable.empty()) {
force_flush = true;
if (force_flush) {
- dout(20) << __func__ << " num_aios=" << num_aios
+ dout(20) << __func__ << " num_aios=" << aios
<< " force_flush=" << (int)force_flush
<< ", flushing, deferred done->stable" << dendl;
// flush/barrier on block device
// iteration there will already be ops awake. otherwise, we
// end up going to sleep, and then wake up when the very first
// transaction is ready for commit.
- throttle_bytes.put(total_cost);
+ throttle_bytes.put(costs);
PExtentVector bluefs_gift_extents;
if (bluefs &&