break;
}
+ case CEPH_OSD_OP_DELETE:
+ // 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 (iter == m->ops.begin() &&
+ iter->op.flags == CEPH_OSD_OP_FLAG_FAILOK) {
+ op->set_skip_promote();
+ }
+ break;
+
default:
break;
}
osd->logger->inc(l_osd_op_cache_hit);
return false;
}
-
+
MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
const object_locator_t& oloc = m->get_object_locator();
return true;
}
+ if (op->need_skip_promote()) {
+ return false;
+ }
+
// older versions do not proxy the feature bits.
bool can_proxy_read = get_osdmap()->get_up_osd_features() &
CEPH_FEATURE_OSD_PROXY_FEATURES;
waiting_for_cache_not_full.push_back(op);
return true;
}
- if (can_skip_promote(op)) {
- return false;
- }
+
if (op->may_write() || write_ordered || !hit_set) {
promote_object(obc, missing_oid, oloc, op);
return true;
waiting_for_cache_not_full.push_back(op);
return true;
}
- if (can_skip_promote(op)) {
- return false;
- }
promote_object(obc, missing_oid, oloc, op);
return true;
}
waiting_for_cache_not_full.push_back(op);
return true;
}
- if (can_skip_promote(op)) {
- return false;
- }
promote_object(obc, missing_oid, oloc, op);
return true;
}
return false;
}
-bool ReplicatedPG::can_skip_promote(OpRequestRef op)
-{
- 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)
{
MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
const object_locator_t& oloc, ///< locator for obc|oid
OpRequestRef op); ///< [optional] client op
- /**
- * Check if the op is such that we can skip promote (e.g., DELETE)
- */
- bool can_skip_promote(OpRequestRef op);
-
int prepare_transaction(OpContext *ctx);
list<pair<OpRequestRef, OpContext*> > in_progress_async_reads;
void complete_read_ctx(int result, OpContext *ctx);