]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Throttle: move start_op() to C_SimpleThrottle constructor 272/head
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 10 May 2013 22:59:10 +0000 (15:59 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Fri, 10 May 2013 23:17:11 +0000 (16:17 -0700)
This is done by all callers right before constructing this.
Since C_SimpleThrottle is already responsible for calling ->end_op(),
it makes sense to call start_op() there too.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/common/Throttle.h
src/librbd/internal.cc

index 192a65a072f8ee1f5d4b7ddc64c832c660bff643..6d039888c633e7dce8904498a4cc801d6b0fc693 100644 (file)
@@ -88,7 +88,9 @@ private:
 
 class C_SimpleThrottle : public Context {
 public:
-  C_SimpleThrottle(SimpleThrottle *throttle) : m_throttle(throttle) {}
+  C_SimpleThrottle(SimpleThrottle *throttle) : m_throttle(throttle) {
+    m_throttle->start_op();
+  }
   virtual void finish(int r) {
     m_throttle->end_op(r);
   }
index 66720ec7d80b8b1be7c264b1163b9c5d88469983..d845886b25f92be483c8c9774b531057fe2bcb3a 100644 (file)
@@ -169,7 +169,6 @@ namespace librbd {
       ldout(cct, 2) << "trim_image objects " << delete_start << " to "
                    << (num_objects - 1) << dendl;
       for (uint64_t i = delete_start; i < num_objects; ++i) {
-       throttle.start_op();
        string oid = ictx->get_object_name(i);
        Context *req_comp = new C_SimpleThrottle(&throttle);
        librados::AioCompletion *rados_completion =
@@ -190,7 +189,6 @@ namespace librbd {
       for (vector<ObjectExtent>::iterator p = extents.begin();
           p != extents.end(); ++p) {
        ldout(ictx->cct, 20) << " ex " << *p << dendl;
-       throttle.start_op();
        Context *req_comp = new C_SimpleThrottle(&throttle);
        librados::AioCompletion *rados_completion =
          librados::Rados::aio_create_completion(req_comp, NULL, rados_ctx_cb);
@@ -339,7 +337,6 @@ namespace librbd {
 
     for (uint64_t i = 0; i < numseg; i++) {
       string oid = ictx->get_object_name(i);
-      throttle.start_op();
       Context *req_comp = new C_SimpleThrottle(&throttle);
       librados::AioCompletion *rados_completion =
        librados::Rados::aio_create_completion(req_comp, NULL, rados_ctx_cb);
@@ -2142,7 +2139,6 @@ reprotect_and_return_err:
 
       bufferlist bl;
       string oid = ictx->get_object_name(ono);
-      throttle.start_op();
       Context *comp = new C_SimpleThrottle(&throttle);
       AioWrite *req = new AioWrite(ictx, oid, ono, 0, objectx, object_overlap,
                                   bl, snapc, CEPH_NOSNAP, comp);