assert(op->ops.size() == op->out_rval.size());
assert(op->ops.size() == op->out_handler.size());
- if (osd_timeout > 0) {
- op->ontimeout = new C_CancelOp(op, this);
- timer.add_event_after(osd_timeout, op->ontimeout);
- }
-
// throttle. before we look at any state, because
// take_op_budget() may drop our lock while it blocks.
- _take_op_budget(op);
+ if (!op->ctx_budgeted || (ctx_budget && (*ctx_budget == -1))) {
+ int op_budget = _take_op_budget(op);
+ // take and pass out the budget for the first OP
+ // in the context session
+ if (ctx_budget && (*ctx_budget == -1)) {
+ *ctx_budget = op_budget;
+ }
+ }
- return _op_submit(op, lc);
+ ceph_tid_t tid = _op_submit(op, lc);
+
+ if (osd_timeout > 0) {
+ Mutex::Locker l(timer_lock);
+ op->ontimeout = new C_CancelOp(tid, this);
+ timer.add_event_after(osd_timeout, op->ontimeout);
+ }
+
+ return tid;
}
ceph_tid_t Objecter::_op_submit(Op *op, RWLock::Context& lc)
assert(op->session->lock.is_wlocked());
- if (op->budgeted)
+ if (!op->ctx_budgeted && op->budgeted)
put_op_budget(op);
+ if (op->ontimeout) {
+ Mutex::Locker l(timer_lock);
+ timer.cancel_event(op->ontimeout);
+ }
+
_session_op_remove(op->session, op);
logger->dec(l_osdc_op_active);