From: Greg Farnum Date: Mon, 19 Feb 2018 23:21:37 +0000 (-0800) Subject: osdc: pass OSDOp vector instead of Op* to calc_op_budget X-Git-Tag: v13.0.2~86^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aadc99224c7570613eb94fbc05f64e9dd3ebc5e0;p=ceph.git osdc: pass OSDOp vector instead of Op* to calc_op_budget We don't need any other portion of the struct and it makes "faking" things easier for pre-calculating budget requirements. Signed-off-by: Greg Farnum --- diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index fd8e208d195c..f23537f45ad2 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -3300,11 +3300,11 @@ void Objecter::_send_op(Op *op) op->session->con->send_message(m); } -int Objecter::calc_op_budget(Op *op) +int Objecter::calc_op_budget(const vector& ops) { int op_budget = 0; - for (vector::iterator i = op->ops.begin(); - i != op->ops.end(); + for (vector::const_iterator i = ops.begin(); + i != ops.end(); ++i) { if (i->op.op & CEPH_OSD_OP_MODE_WR) { op_budget += i->indata.length(); @@ -3328,7 +3328,7 @@ void Objecter::_throttle_op(Op *op, bool locked_for_write = sul.owns_lock(); if (!op_budget) - op_budget = calc_op_budget(op); + op_budget = calc_op_budget(op->ops); if (!op_throttle_bytes.get_or_fail(op_budget)) { //couldn't take right now sul.unlock(); op_throttle_bytes.get(op_budget); diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 1aca8a82932b..2efe5986b593 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1989,11 +1989,11 @@ private: * and returned whenever an op is removed from the map * If throttle_op needs to throttle it will unlock client_lock. */ - int calc_op_budget(Op *op); + int calc_op_budget(const vector& ops); void _throttle_op(Op *op, shunique_lock& sul, int op_size = 0); int _take_op_budget(Op *op, shunique_lock& sul) { assert(sul && sul.mutex() == &rwlock); - int op_budget = calc_op_budget(op); + int op_budget = calc_op_budget(op->ops); if (keep_balanced_budget) { _throttle_op(op, sul, op_budget); } else { @@ -2010,7 +2010,7 @@ private: } void put_op_budget(Op *op) { assert(op->budgeted); - int op_budget = calc_op_budget(op); + int op_budget = calc_op_budget(op->ops); put_op_budget_bytes(op_budget); } void put_nlist_context_budget(NListContext *list_context);