}
if ((m->get_flags() & CEPH_OSD_FLAG_IGNORE_CACHE) == 0 &&
- maybe_handle_cache(op, obc, r))
+ maybe_handle_cache(op, obc, r, missing_oid))
return;
if (r) {
}
bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, ObjectContextRef obc,
- int r)
+ int r, const hobject_t& missing_oid)
{
if (obc)
dout(25) << __func__ << " " << obc->obs.oi << " "
- << (obc->obs.exists ? "exists" : "DNE") << dendl;
+ << (obc->obs.exists ? "exists" : "DNE")
+ << " missing_oid " << missing_oid
+ << dendl;
else
- dout(25) << __func__ << " (no obc)" << dendl;
+ dout(25) << __func__ << " (no obc)"
+ << " missing_oid " << missing_oid
+ << dendl;
if (obc.get() && obc->is_blocked()) {
// we're already doing something with this object
if (can_skip_promote(op, obc)) {
return false;
}
- promote_object(op, obc);
+ promote_object(op, obc, missing_oid);
return true;
case pg_pool_t::CACHEMODE_FORWARD:
case pg_pool_t::CACHEMODE_READONLY: // TODO: clean this case up
if (!obc.get() && r == -ENOENT) {
// we don't have the object and op's a read
- promote_object(op, obc);
+ promote_object(op, obc, missing_oid);
return true;
}
if (obc.get() && obc->obs.exists) { // we have the object locally
}
};
-void ReplicatedPG::promote_object(OpRequestRef op, ObjectContextRef obc)
+void ReplicatedPG::promote_object(OpRequestRef op, ObjectContextRef obc,
+ const hobject_t& missing_oid)
{
MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
- if (!obc.get()) { // we need to create an ObjectContext
- int r = find_object_context(
- hobject_t(m->get_oid(),
- m->get_object_locator().key,
- m->get_snapid(),
- m->get_pg().ps(),
- m->get_object_locator().get_pool(),
- m->get_object_locator().nspace),
- &obc, true, NULL);
- assert(r == 0); // a lookup that allows creates can't fail now
+ if (!obc) { // we need to create an ObjectContext
+ assert(missing_oid != hobject_t());
+ obc = get_object_context(missing_oid, true);
}
dout(10) << __func__ << " " << obc->obs.oi.soid << dendl;
* 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, ObjectContextRef obc, int r,
+ const hobject_t& missing_oid);
/**
* This helper function tells the client to redirect their request elsewhere.
*/
/**
* This function starts up a copy from
*/
- void promote_object(OpRequestRef op, ObjectContextRef obc);
+ void promote_object(OpRequestRef op, ObjectContextRef obc,
+ const hobject_t& missing_object);
/**
* Check if the op is such that we can skip promote (e.g., DELETE)