]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: drop ImageDispatchInterface::handle_finished virtual method
authorJason Dillaman <dillaman@redhat.com>
Mon, 31 Aug 2020 22:07:14 +0000 (18:07 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 18 Sep 2020 03:52:32 +0000 (23:52 -0400)
Any dispatch layer can now directly place themselves in the finish
callback handler chain without the use of the generic callback.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/exclusive_lock/ImageDispatch.h
src/librbd/io/ImageDispatch.h
src/librbd/io/ImageDispatchInterface.h
src/librbd/io/ImageDispatcher.cc
src/librbd/io/ImageDispatcher.h
src/librbd/io/ImageDispatcherInterface.h
src/librbd/io/QosImageDispatch.h
src/librbd/io/QueueImageDispatch.h
src/librbd/io/RefreshImageDispatch.h
src/librbd/io/WriteBlockImageDispatch.h
src/test/librbd/mock/io/MockImageDispatch.h

index 5a3e9259c8ed4d13e538cde7489bb9af3da9c3a5..7f0353b39e1fd6695f8f9f4c9a6f8b652f37de71 100644 (file)
@@ -89,9 +89,6 @@ public:
       io::DispatchResult* dispatch_result, Context** on_finish,
       Context* on_dispatched) override;
 
-  void handle_finished(int r, uint64_t tid) override {
-  }
-
 private:
   typedef std::list<Context*> Contexts;
   typedef std::unordered_set<uint64_t> Tids;
index c1f15404f9c7ccadefe7c72c29d9b47043e73b36..5ace3ec79e594fd8d113990c79d30f724e7df525 100644 (file)
@@ -73,8 +73,6 @@ public:
       DispatchResult* dispatch_result, Context** on_finish,
       Context* on_dispatched) override;
 
-  void handle_finished(int r, uint64_t tid) override {}
-
 private:
   ImageCtxT* m_image_ctx;
 
index 6b0770dc8df0bfbda1d6ba144d564d58e41347a1..bf44ee8ad63187823934486142a9557bd980bd95 100644 (file)
@@ -70,8 +70,6 @@ struct ImageDispatchInterface {
       DispatchResult* dispatch_result, Context** on_finish,
       Context* on_dispatched) = 0;
 
-  virtual void handle_finished(int r, uint64_t tid) = 0;
-
 };
 
 } // namespace io
index 5226e9ec95da66c16696a2e045e6610a262318ec..03b30a04bf20573ae0dbeaacac48dc66aafd78af 100644 (file)
@@ -182,38 +182,6 @@ void ImageDispatcher<I>::wait_on_writes_unblocked(Context *on_unblocked) {
   m_write_block_dispatch->wait_on_writes_unblocked(on_unblocked);
 }
 
-template <typename I>
-void ImageDispatcher<I>::finish(int r, ImageDispatchLayer image_dispatch_layer,
-                                uint64_t tid) {
-  auto cct = this->m_image_ctx->cct;
-  ldout(cct, 20) << "r=" << r << ", tid=" << tid << dendl;
-
-  // loop in reverse order from last invoked dispatch layer calling its
-  // handle_finished method
-  while (image_dispatch_layer != IMAGE_DISPATCH_LAYER_NONE) {
-    std::shared_lock locker{this->m_lock};
-    auto it = this->m_dispatches.find(image_dispatch_layer);
-    image_dispatch_layer = static_cast<ImageDispatchLayer>(
-      image_dispatch_layer - 1);
-
-    if (it == this->m_dispatches.end()) {
-      continue;
-    }
-
-    // track callback while lock is dropped so that the layer cannot be shutdown
-    auto& dispatch_meta = it->second;
-    auto dispatch = dispatch_meta.dispatch;
-    auto async_op_tracker = dispatch_meta.async_op_tracker;
-    async_op_tracker->start_op();
-    locker.unlock();
-
-    dispatch->handle_finished(r, tid);
-
-    // safe since dispatch_meta cannot be deleted until ops finished
-    async_op_tracker->finish_op();
-  }
-}
-
 template <typename I>
 bool ImageDispatcher<I>::send_dispatch(
     ImageDispatchInterface* image_dispatch,
index bfbea68c9213cd9f202a9cf549058fc1bf9df3b3..176b2a229fe9cab25b1feffb99dea384f9003e27 100644 (file)
@@ -43,9 +43,6 @@ public:
   void unblock_writes() override;
   void wait_on_writes_unblocked(Context *on_unblocked) override;
 
-  void finish(int r, ImageDispatchLayer image_dispatch_layer,
-              uint64_t tid) override;
-
 protected:
   bool send_dispatch(
     ImageDispatchInterface* image_dispatch,
index 9259479b53e448181b2ec6b784138ebb7c57490b..78f90977d7805701ca27351a503dcd86a0169ffb 100644 (file)
@@ -27,9 +27,6 @@ public:
 
   virtual void unblock_writes() = 0;
   virtual void wait_on_writes_unblocked(Context *on_unblocked) = 0;
-
-  virtual void finish(int r, ImageDispatchLayer image_dispatch_layer,
-                      uint64_t tid) = 0;
 };
 
 } // namespace io
index 4ddd21b99cdd49e7bbfd6a0b075453af0788abcc..386cf0b4eef7a2acb430a1f1f0361c47e3bd9af0 100644 (file)
@@ -90,8 +90,6 @@ public:
       DispatchResult* dispatch_result, Context** on_finish,
       Context* on_dispatched) override;
 
-  void handle_finished(int r, uint64_t tid) override;
-
 private:
   ImageCtxT* m_image_ctx;
 
@@ -100,6 +98,8 @@ private:
 
   FlushTracker<ImageCtxT>* m_flush_tracker;
 
+  void handle_finished(int r, uint64_t tid);
+
   bool set_throttle_flag(std::atomic<uint32_t>* image_dispatch_flags,
                          uint32_t flag);
   bool needs_throttle(bool read_op, const Extents& image_extents, uint64_t tid,
index cbadad95ec1d385d3e161e9d7577a7fd277d900d..c1d0ac4c6156091994b4959e89cc412d098c4084 100644 (file)
@@ -77,13 +77,13 @@ public:
       DispatchResult* dispatch_result, Context** on_finish,
       Context* on_dispatched) override;
 
-  void handle_finished(int r, uint64_t tid) override;
-
 private:
   ImageCtxT* m_image_ctx;
 
   FlushTracker<ImageCtxT>* m_flush_tracker;
 
+  void handle_finished(int r, uint64_t tid);
+
   bool enqueue(bool read_op, uint64_t tid, DispatchResult* dispatch_result,
                Context** on_finish, Context* on_dispatched);
 
index 3510b350f4cc8d1a2446922ec15d9bb6bf602a45..e9c53772fcdbd1eef2ddae30267fc87df9b5115e 100644 (file)
@@ -73,8 +73,6 @@ public:
       DispatchResult* dispatch_result, Context** on_finish,
       Context* on_dispatched) override;
 
-  void handle_finished(int r, uint64_t tid) override {}
-
 private:
   ImageCtxT* m_image_ctx;
 
index adbb357c1cd26d1a53b7190daa84697395a12d91..00e2c89c00313c22b7ae380f9391c2d4d2498875 100644 (file)
@@ -89,8 +89,6 @@ public:
       DispatchResult* dispatch_result, Context** on_finish,
       Context* on_dispatched) override;
 
-  void handle_finished(int r, uint64_t tid) override;
-
 private:
   struct C_BlockedWrites;
 
@@ -107,6 +105,8 @@ private:
   Contexts m_write_blocker_contexts;
   Contexts m_unblocked_write_waiter_contexts;
 
+  void handle_finished(int r, uint64_t tid);
+
   bool process_io(uint64_t tid, DispatchResult* dispatch_result,
                   Context** on_finish, Context* on_dispatched);
   void flush_io(Context* on_finish);
index 683c8003ec0602342fe7ce019041973ce33d6f91..d4c145e8cc378fe4d4b6ba792a195b4f1f91c41a 100644 (file)
@@ -77,8 +77,6 @@ public:
     return false;
   }
 
-  void handle_finished(int r, uint64_t tid) override {};
-
 };
 
 } // namespace io