]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: AsyncRequest is now optional for AsyncObjectThrottle
authorJason Dillaman <dillaman@redhat.com>
Tue, 21 Apr 2015 13:54:53 +0000 (09:54 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 7 May 2015 02:07:46 +0000 (22:07 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/AsyncFlattenRequest.cc
src/librbd/AsyncObjectThrottle.cc
src/librbd/AsyncObjectThrottle.h
src/librbd/AsyncTrimRequest.cc
src/librbd/RebuildObjectMapRequest.cc

index 06020f277eedace52699079b4670f660ebe461f8..79a96d57c264a8b7ff81ce906121dbffdea1c8a2 100644 (file)
@@ -100,7 +100,7 @@ void AsyncFlattenRequest::send() {
       boost::lambda::_1, &m_image_ctx, m_object_size, m_snapc,
       boost::lambda::_2));
   AsyncObjectThrottle *throttle = new AsyncObjectThrottle(
-    *this, context_factory, create_callback_context(), &m_prog_ctx, 0,
+    this, context_factory, create_callback_context(), &m_prog_ctx, 0,
     m_overlap_objects);
   throttle->start_ops(m_image_ctx.concurrent_management_ops);
 }
index 3274f1618df1e418a611006b7d88c65eb718c181..7c02e03920e48c7565241e9b3a02b69907dde1d1 100644 (file)
@@ -7,7 +7,7 @@
 namespace librbd
 {
 
-AsyncObjectThrottle::AsyncObjectThrottle(const AsyncRequest& async_request,
+AsyncObjectThrottle::AsyncObjectThrottle(const AsyncRequest* async_request,
                                          const ContextFactory& context_factory,
                                         Context *ctx, ProgressContext *prog_ctx,
                                         uint64_t object_no,
@@ -58,7 +58,8 @@ void AsyncObjectThrottle::finish_op(int r) {
 void AsyncObjectThrottle::start_next_op() {
   bool done = false;
   while (!done) {
-    if (m_async_request.is_canceled() && m_ret == 0) {
+    if (m_async_request != NULL && m_async_request->is_canceled() &&
+        m_ret == 0) {
       // allow in-flight ops to complete, but don't start new ops
       m_ret = -ERESTART;
       return;
index 892c4234251f660aa77bb7cf42e6a7e360403c3a..3ac9561dc94c51a6d9a114daef3742f07f90c3c7 100644 (file)
@@ -43,7 +43,7 @@ public:
   typedef boost::function<C_AsyncObjectThrottle*(AsyncObjectThrottle&,
                                           uint64_t)> ContextFactory;
 
-  AsyncObjectThrottle(const AsyncRequest &async_request,
+  AsyncObjectThrottle(const AsyncRequest *async_request,
                       const ContextFactory& context_factory, Context *ctx,
                      ProgressContext *prog_ctx, uint64_t object_no,
                      uint64_t end_object_no);
@@ -53,7 +53,7 @@ public:
 
 private:
   Mutex m_lock;
-  const AsyncRequest &m_async_request;
+  const AsyncRequest *m_async_request;
   ContextFactory m_context_factory;
   Context *m_ctx;
   ProgressContext *m_prog_ctx;
index e2ebeadba73c15fbc056f9f2b29a1ac8d7aa7743..e403be2593fb32499d1d1bfa499b32112ec1d33a 100644 (file)
@@ -149,7 +149,7 @@ void AsyncTrimRequest::send_remove_objects() {
     boost::lambda::bind(boost::lambda::new_ptr<AsyncTrimObjectContext>(),
       boost::lambda::_1, &m_image_ctx, boost::lambda::_2));
   AsyncObjectThrottle *throttle = new AsyncObjectThrottle(
-    *this, context_factory, ctx, &m_prog_ctx, m_delete_start, m_num_objects);
+    this, context_factory, ctx, &m_prog_ctx, m_delete_start, m_num_objects);
   throttle->start_ops(m_image_ctx.concurrent_management_ops);
 }
 
index 4cddbaf5f759e56f8343bc0403c61ed8defb7426..4c7c562d557dcb3ee961d838a8e274c805fbb17a 100644 (file)
@@ -321,7 +321,7 @@ void RebuildObjectMapRequest::send_verify_objects() {
     boost::lambda::bind(boost::lambda::new_ptr<C_VerifyObject>(),
       boost::lambda::_1, &m_image_ctx, snap_id, boost::lambda::_2));
   AsyncObjectThrottle *throttle = new AsyncObjectThrottle(
-    *this, context_factory, create_callback_context(), &m_prog_ctx, 0,
+    this, context_factory, create_callback_context(), &m_prog_ctx, 0,
     num_objects);
   throttle->start_ops(cct->_conf->rbd_concurrent_management_ops);
 }