From: Jason Dillaman Date: Tue, 21 Apr 2015 13:49:32 +0000 (-0400) Subject: librbd: progress context is now optional for AsyncObjectThrottle X-Git-Tag: v9.0.2~225^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d5b4e7827db7fd9480c6e006e1084dbe222ba68c;p=ceph.git librbd: progress context is now optional for AsyncObjectThrottle Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/AsyncFlattenRequest.cc b/src/librbd/AsyncFlattenRequest.cc index f8fbde0472ae..06020f277eed 100644 --- a/src/librbd/AsyncFlattenRequest.cc +++ b/src/librbd/AsyncFlattenRequest.cc @@ -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); } diff --git a/src/librbd/AsyncObjectThrottle.cc b/src/librbd/AsyncObjectThrottle.cc index 4290eb8636c0..3274f1618df1 100644 --- a/src/librbd/AsyncObjectThrottle.cc +++ b/src/librbd/AsyncObjectThrottle.cc @@ -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); + } } } diff --git a/src/librbd/AsyncObjectThrottle.h b/src/librbd/AsyncObjectThrottle.h index 83d69d8c773c..892c4234251f 100644 --- a/src/librbd/AsyncObjectThrottle.h +++ b/src/librbd/AsyncObjectThrottle.h @@ -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; diff --git a/src/librbd/AsyncTrimRequest.cc b/src/librbd/AsyncTrimRequest.cc index 5a255dca3351..e2ebeadba73c 100644 --- a/src/librbd/AsyncTrimRequest.cc +++ b/src/librbd/AsyncTrimRequest.cc @@ -149,7 +149,7 @@ void AsyncTrimRequest::send_remove_objects() { boost::lambda::bind(boost::lambda::new_ptr(), 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); } diff --git a/src/librbd/RebuildObjectMapRequest.cc b/src/librbd/RebuildObjectMapRequest.cc index 87cee7e421d4..4cddbaf5f759 100644 --- a/src/librbd/RebuildObjectMapRequest.cc +++ b/src/librbd/RebuildObjectMapRequest.cc @@ -321,7 +321,7 @@ void RebuildObjectMapRequest::send_verify_objects() { boost::lambda::bind(boost::lambda::new_ptr(), 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); }