case pg_pool_t::CACHEMODE_WRITEBACK:
if (obc.get() && obc->obs.exists) { // we have the object already
return false;
+ } else if (can_skip_promote(op, obc)) {
+ return false;
} else { // try and promote!
promote_object(op, obc);
return true;
return false;
}
+bool ReplicatedPG::can_skip_promote(OpRequestRef op, ObjectContextRef obc)
+{
+ MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
+ if (m->ops.empty())
+ return false;
+ // if we get a delete with FAILOK we can skip promote. without
+ // FAILOK we still need to promote (or do something smarter) to
+ // determine whether to return ENOENT or 0.
+ if (m->ops[0].op.op == CEPH_OSD_OP_DELETE &&
+ (m->ops[0].op.flags & CEPH_OSD_OP_FLAG_FAILOK))
+ return true;
+ return false;
+}
+
void ReplicatedPG::do_cache_redirect(OpRequestRef op, ObjectContextRef obc)
{
MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
*/
void promote_object(OpRequestRef op, ObjectContextRef obc);
+ /**
+ * Check if the op is such that we can skip promote (e.g., DELETE)
+ */
+ bool can_skip_promote(OpRequestRef op, ObjectContextRef obc);
+
int prepare_transaction(OpContext *ctx);
// pg on-disk content