]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/cache/pwl: Check the cache is clean
authorYin Congmin <congmin.yin@intel.com>
Thu, 16 Sep 2021 11:05:38 +0000 (11:05 +0000)
committerDeepika Upadhyay <dupadhya@redhat.com>
Fri, 5 Nov 2021 10:08:59 +0000 (15:38 +0530)
Signed-off-by: Yin Congmin <congmin.yin@intel.com>
(cherry picked from commit 066b8a6d2ee091839b9b21ac89b8dfcebf8825cd)

src/librbd/cache/pwl/AbstractWriteLog.cc
src/librbd/cache/pwl/AbstractWriteLog.h

index 89527c3f0a468a7f0d68711b91b6fd2b60daecfc..3da2d9a82c2d5bbfbf80fd9f5e9215c8e906558f 100644 (file)
@@ -623,7 +623,7 @@ void AbstractWriteLog<I>::shut_down(Context *on_finish) {
       }
       {
         std::lock_guard locker(m_lock);
-        ceph_assert(m_dirty_log_entries.size() == 0);
+        check_image_cache_state_clean();
         m_wake_up_enabled = false;
         m_cache_state->clean = true;
         m_log_entries.clear();
@@ -2084,6 +2084,20 @@ bool AbstractWriteLog<I>::can_retire_entry(std::shared_ptr<GenericLogEntry> log_
   return log_entry->can_retire();
 }
 
+template <typename I>
+void AbstractWriteLog<I>::check_image_cache_state_clean() {
+  ceph_assert(m_deferred_ios.empty());
+  ceph_assert(m_ops_to_append.empty());;
+  ceph_assert(m_async_flush_ops == 0);
+  ceph_assert(m_async_append_ops == 0);
+  ceph_assert(m_dirty_log_entries.empty());
+  ceph_assert(m_ops_to_flush.empty());
+  ceph_assert(m_flush_ops_in_flight == 0);
+  ceph_assert(m_flush_bytes_in_flight == 0);
+  ceph_assert(m_bytes_dirty == 0);
+  ceph_assert(m_work_queue.empty());
+}
+
 } // namespace pwl
 } // namespace cache
 } // namespace librbd
index 128c00d99d82a2217b3aff210e63cc4482dcc860..88e6470f12f7b4cd284b9490a2b6d40343dfd1d3 100644 (file)
@@ -234,6 +234,7 @@ private:
 
   void pwl_init(Context *on_finish, pwl::DeferredContexts &later);
   void update_image_cache_state(Context *on_finish);
+  void check_image_cache_state_clean();
 
   void flush_dirty_entries(Context *on_finish);
   bool can_flush_entry(const std::shared_ptr<pwl::GenericLogEntry> log_entry);