]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: pass OSDOp vector instead of Op* to calc_op_budget
authorGreg Farnum <gfarnum@redhat.com>
Mon, 19 Feb 2018 23:21:37 +0000 (15:21 -0800)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Feb 2018 19:50:18 +0000 (11:50 -0800)
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 <gfarnum@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index fd8e208d195c10224184e7ed7fd6837b59665038..f23537f45ad2f04a94771ca336c63e9cc18f458f 100644 (file)
@@ -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<OSDOp>& ops)
 {
   int op_budget = 0;
-  for (vector<OSDOp>::iterator i = op->ops.begin();
-       i != op->ops.end();
+  for (vector<OSDOp>::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);
index 1aca8a82932b7376b246a199a1d01303587e7be9..2efe5986b5930b251df1734d1061b891e24a84a1 100644 (file)
@@ -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<OSDOp>& 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);