]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Journaler: add have_waiter()
authorJohn Spray <john.spray@redhat.com>
Thu, 1 Dec 2016 18:59:26 +0000 (18:59 +0000)
committerJohn Spray <john.spray@redhat.com>
Wed, 8 Mar 2017 10:20:55 +0000 (10:20 +0000)
Allows users of wait_for_readable to conveniently
see if there is already a waiter.  Yes, they could
do this themselves, but I'd rather peek at an existing
variable than add a new one caller-side.

Signed-off-by: John Spray <john.spray@redhat.com>
src/osdc/Journaler.cc
src/osdc/Journaler.h

index 629450d030fa17641710a7c318c6254094f37dc7..22e5327c11c1db25097bf968b6afd303fff3224f 100644 (file)
@@ -946,7 +946,9 @@ void Journaler::_assimilate_prefetch()
 
   if ((got_any && !was_readable && readable) || read_pos == write_pos) {
     // readable!
-    ldout(cct, 10) << "_finish_read now readable (or at journal end)" << dendl;
+    ldout(cct, 10) << "_finish_read now readable (or at journal end) readable="
+                   << readable << " read_pos=" << read_pos << " write_pos="
+                   << write_pos << dendl;
     if (on_readable) {
       C_OnFinisher *f = on_readable;
       on_readable = 0;
@@ -1216,6 +1218,11 @@ void Journaler::wait_for_readable(Context *onreadable)
   }
 }
 
+bool Journaler::have_waiter() const
+{
+  return on_readable != nullptr;
+}
+
 
 
 
index cf0e08c63e96bdfb3fcb6082b441d240f2a07c8d..5532d5c07c6fc9c732bd2de4d7f4c2008a06a49a 100644 (file)
@@ -442,6 +442,7 @@ public:
   void wait_for_flush(Context *onsafe = 0);
   void flush(Context *onsafe = 0);
   void wait_for_readable(Context *onfinish);
+  bool have_waiter() const;
 
   // Synchronous setters
   // ===================