]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: progress context is now optional for AsyncObjectThrottle
authorJason Dillaman <dillaman@redhat.com>
Tue, 21 Apr 2015 13:49:32 +0000 (09:49 -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 f8fbde0472ae4e015fe9409611fb48ffd3e8371d..06020f277eedace52699079b4670f660ebe461f8 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 4290eb8636c03178d7e4be86821063dfc6e5c26f..3274f1618df1e418a611006b7d88c65eb718c181 100644 (file)
@@ -9,7 +9,7 @@ namespace librbd
 
 AsyncObjectThrottle::AsyncObjectThrottle(const AsyncRequest& async_request,
                                          const ContextFactory& context_factory,
-                                        Context *ctx, ProgressContext &prog_ctx,
+                                        Context *ctx, ProgressContext *prog_ctx,
                                         uint64_t object_no,
                                         uint64_t end_object_no)
   : m_lock("librbd::AsyncThrottle::m_lock"),
@@ -81,7 +81,9 @@ void AsyncObjectThrottle::start_next_op() {
       ++m_current_ops;
       done = true;
     }
-    m_prog_ctx.update_progress(ono, m_end_object_no);
+    if (m_prog_ctx != NULL) {
+      m_prog_ctx->update_progress(ono, m_end_object_no);
+    }
   }
 }
 
index 83d69d8c773c1cdd5d4c36cd3feb933e58bf9fd7..892c4234251f660aa77bb7cf42e6a7e360403c3a 100644 (file)
@@ -45,7 +45,7 @@ public:
 
   AsyncObjectThrottle(const AsyncRequest &async_request,
                       const ContextFactory& context_factory, Context *ctx,
-                     ProgressContext &prog_ctx, uint64_t object_no,
+                     ProgressContext *prog_ctx, uint64_t object_no,
                      uint64_t end_object_no);
 
   void start_ops(uint64_t max_concurrent);
@@ -56,7 +56,7 @@ private:
   const AsyncRequest &m_async_request;
   ContextFactory m_context_factory;
   Context *m_ctx;
-  ProgressContext &m_prog_ctx;
+  ProgressContext *m_prog_ctx;
   uint64_t m_object_no;
   uint64_t m_end_object_no;
   uint64_t m_current_ops;
index 5a255dca3351d48297b3c923188a8ca1d4685a2e..e2ebeadba73c15fbc056f9f2b29a1ac8d7aa7743 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 87cee7e421d434d1b857412480a49b999b714cb9..4cddbaf5f759e56f8343bc0403c61ed8defb7426 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);
 }