Merge pull request #21242 from majianpeng/objecter-calc-budget

osdc: Change 'bool budgeted' to 'int budget' to avoid recalculating.

Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2018-05-04 09:16:14 +08:00 committed by GitHub
commit d2441ea27c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View File

@ -3126,8 +3126,10 @@ void Objecter::_finish_op(Op *op, int r)
// op->session->lock is locked unique or op->session is null
if (!op->ctx_budgeted && op->budgeted)
put_op_budget(op);
if (!op->ctx_budgeted && op->budget >= 0) {
put_op_budget_bytes(op->budget);
op->budget = -1;
}
if (op->ontimeout && r != -ETIMEDOUT)
timer.cancel_event(op->ontimeout);

View File

@ -1373,7 +1373,7 @@ public:
epoch_t map_dne_bound;
bool budgeted;
int budget;
/// true if we should resend this message on failure
bool should_resend;
@ -1406,7 +1406,7 @@ public:
objver(ov),
reply_epoch(NULL),
map_dne_bound(0),
budgeted(false),
budget(-1),
should_resend(true),
ctx_budgeted(false),
data_offset(offset) {
@ -2001,7 +2001,7 @@ private:
op_throttle_bytes.take(op_budget);
op_throttle_ops.take(1);
}
op->budgeted = true;
op->budget = op_budget;
return op_budget;
}
int take_linger_budget(LingerOp *info);
@ -2011,11 +2011,6 @@ private:
op_throttle_bytes.put(op_budget);
op_throttle_ops.put(1);
}
void put_op_budget(Op *op) {
assert(op->budgeted);
int op_budget = calc_op_budget(op->ops);
put_op_budget_bytes(op_budget);
}
void put_nlist_context_budget(NListContext *list_context);
Throttle op_throttle_bytes, op_throttle_ops;