}
}
+ // successfully flushed, can we evict this object?
+ if (!fop->op && agent_state->evict_mode != TierAgentState::EVICT_MODE_IDLE &&
+ agent_maybe_evict(obc, true)) {
+ osd->logger->inc(l_osd_tier_clean);
+ if (fop->on_flush) {
+ Context *on_flush = fop->on_flush;
+ fop->on_flush = NULL;
+ on_flush->complete(0);
+ }
+ flush_ops.erase(oid);
+ return 0;
+ }
+
// successfully flushed; can we clear the dirty bit?
// try to take the lock manually, since we don't
// have a ctx yet.
}
if (agent_state->evict_mode != TierAgentState::EVICT_MODE_IDLE &&
- agent_maybe_evict(obc))
+ agent_maybe_evict(obc, false))
++started;
else if (agent_state->flush_mode != TierAgentState::FLUSH_MODE_IDLE &&
agent_flush_quota > 0 && agent_maybe_flush(obc)) {
}
};
-bool ReplicatedPG::agent_maybe_evict(ObjectContextRef& obc)
+bool ReplicatedPG::agent_maybe_evict(ObjectContextRef& obc, bool after_flush)
{
const hobject_t& soid = obc->obs.oi.soid;
- if (obc->obs.oi.is_dirty()) {
+ if (!after_flush && obc->obs.oi.is_dirty()) {
dout(20) << __func__ << " skip (dirty) " << obc->obs.oi << dendl;
return false;
}
ctx->delta_stats.num_objects_omap--;
ctx->delta_stats.num_evict++;
ctx->delta_stats.num_evict_kb += SHIFT_ROUND_UP(obc->obs.oi.size, 10);
+ if (obc->obs.oi.is_dirty())
+ --ctx->delta_stats.num_objects_dirty;
assert(r == 0);
finish_ctx(ctx, pg_log_entry_t::DELETE, false);
simple_repop_submit(repop);
}
bool agent_work(int max, int agent_flush_quota);
bool agent_maybe_flush(ObjectContextRef& obc); ///< maybe flush
- bool agent_maybe_evict(ObjectContextRef& obc); ///< maybe evict
+ bool agent_maybe_evict(ObjectContextRef& obc, bool after_flush); ///< maybe evict
void agent_load_hit_sets(); ///< load HitSets, if needed