]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: expose Journaler::write_head_needed
authorJohn Spray <john.spray@redhat.com>
Mon, 13 Feb 2017 12:00:42 +0000 (12:00 +0000)
committerJohn Spray <john.spray@redhat.com>
Wed, 8 Mar 2017 10:27:01 +0000 (10:27 +0000)
So that callers on the read side can optionally
do their own write_head calls according to
the same condition that Journaler uses
internally for its write_head during _flush() condition.

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

index b19c3cbeaabc73ca71a0653f6070a7653f629248..116432c3b79f0ffe1642a23b0b0b119dbd8e112e 100644 (file)
@@ -722,12 +722,17 @@ void Journaler::_flush(C_OnFinisher *onsafe)
   }
 
   // write head?
-  if (last_wrote_head + seconds(cct->_conf->journaler_write_head_interval)
-      < ceph::real_clock::now()) {
+  if (_write_head_needed()) {
     _write_head();
   }
 }
 
+bool Journaler::_write_head_needed()
+{
+  return last_wrote_head + seconds(cct->_conf->journaler_write_head_interval)
+      < ceph::real_clock::now();
+}
+
 
 /*************** prezeroing ******************/
 
index 6a731993bc0e0805ed765bc8da14b989fcc7e7b0..26a09a7aeda1c0ecf171a5e6a8eba5078d174850 100644 (file)
@@ -467,6 +467,13 @@ public:
       trimming_pos = trimmed_pos = p;
   }
 
+  bool _write_head_needed();
+  bool write_head_needed() {
+    lock_guard l(lock);
+    return _write_head_needed();
+  }
+
+
   void trim();
   void trim_tail() {
     lock_guard l(lock);