]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: new exclusive lock accept_replay helper method
authorJason Dillaman <dillaman@redhat.com>
Tue, 30 May 2017 19:50:44 +0000 (15:50 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 1 Jun 2017 16:24:11 +0000 (12:24 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/ExclusiveLock.cc
src/librbd/ExclusiveLock.h

index 1688afca98cf4cf40984bdd8488207e15171c357..3b5f041892109444257762b28eb6c35096d0914c 100644 (file)
@@ -50,6 +50,18 @@ bool ExclusiveLock<I>::accept_requests(int *ret_val) const {
   return accept_requests;
 }
 
+template <typename I>
+bool ExclusiveLock<I>::accept_ops() const {
+  Mutex::Locker locker(ML<I>::m_lock);
+  bool accept_ops = (!ML<I>::is_state_shutdown() &&
+                     !ML<I>::is_state_pre_releasing() &&
+                     (ML<I>::is_state_locked() ||
+                      ML<I>::is_state_post_acquiring()));
+
+  ldout(m_image_ctx.cct, 20) << "=" << accept_ops << dendl;
+  return accept_ops;
+}
+
 template <typename I>
 void ExclusiveLock<I>::block_requests(int r) {
   Mutex::Locker locker(ML<I>::m_lock);
index 3b2a756edc0a45180b45e958cd21ead333624cc8..102501f5fbfce5401b2cbd457af650c40188fca4 100644 (file)
@@ -19,6 +19,7 @@ public:
   ExclusiveLock(ImageCtxT &image_ctx);
 
   bool accept_requests(int *ret_val = nullptr) const;
+  bool accept_ops() const;
 
   void block_requests(int r);
   void unblock_requests();