}
if ((m->get_flags() & CEPH_OSD_FLAG_IGNORE_CACHE) == 0 &&
- maybe_handle_cache(op, obc, r, missing_oid))
+ maybe_handle_cache(op, write_ordered, obc, r, missing_oid, false))
return;
if (r) {
// missing the specific snap we need; requeue and wait.
wait_for_missing_object(wait_oid, op);
} else if (r) {
- if (!maybe_handle_cache(op, sobc, r, wait_oid, true))
+ if (!maybe_handle_cache(op, write_ordered, sobc, r, wait_oid, true))
osd->reply_op_error(op, r);
} else if (sobc->obs.oi.is_whiteout()) {
osd->reply_op_error(op, -ENOENT);
// missing the specific snap we need; requeue and wait.
wait_for_missing_object(wait_oid, op);
} else if (r) {
- if (!maybe_handle_cache(op, sobc, r, wait_oid, true))
+ if (!maybe_handle_cache(op, write_ordered, sobc, r, wait_oid, true))
osd->reply_op_error(op, r);
} else {
dout(10) << " clone_oid " << clone_oid << " obc " << sobc << dendl;
execute_ctx(ctx);
}
-bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, ObjectContextRef obc,
+bool ReplicatedPG::maybe_handle_cache(OpRequestRef op,
+ bool write_ordered,
+ ObjectContextRef obc,
int r, const hobject_t& missing_oid,
bool must_promote)
{
if (obc.get() && obc->obs.exists) {
return false;
}
+ if (agent_state &&
+ agent_state->evict_mode == TierAgentState::EVICT_MODE_FULL) {
+ if (!op->may_write() && !op->may_cache() && !write_ordered) {
+ dout(20) << __func__ << " cache pool full, redirecting read" << dendl;
+ do_cache_redirect(op, obc);
+ return true;
+ }
+ // FIXME: do something clever with writes.
+ }
if (!must_promote && can_skip_promote(op, obc)) {
return false;
}
wait_for_missing_object(missing_oid, ctx->op);
return ret;
}
- if (maybe_handle_cache(ctx->op, rollback_to, ret, missing_oid, true)) {
+ if (maybe_handle_cache(ctx->op, true, rollback_to, ret, missing_oid, true)) {
// promoting the rollback src, presumably
return -EAGAIN;
}
* This helper function is called from do_op if the ObjectContext lookup fails.
* @returns true if the caching code is handling the Op, false otherwise.
*/
- inline bool maybe_handle_cache(OpRequestRef op, ObjectContextRef obc, int r,
+ inline bool maybe_handle_cache(OpRequestRef op,
+ bool write_ordered,
+ ObjectContextRef obc, int r,
const hobject_t& missing_oid,
- bool must_promote = false);
+ bool must_promote);
/**
* This helper function tells the client to redirect their request elsewhere.
*/