]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: Change 'bool budgeted' to 'int budget' to avoid recalculating. 21242/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Sun, 15 Apr 2018 23:18:08 +0000 (07:18 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Mon, 23 Apr 2018 22:39:28 +0000 (06:39 +0800)
Avoing recalculating in op finish stage.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 90de55e756adbf3c8fded7215642f19ed8af2710..ad1b27c6355bfaa0c55150e01d9d7d8af89e5dd4 100644 (file)
@@ -3121,8 +3121,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);
index 64f3d329cf879fc8aaa3faf60a19406af1fdddf5..7d23313602a9b251538916925d395634f519e089 100644 (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;