]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/FileJournal: Update the journal header when closing journal
authorMa Jianpeng <jianpeng.ma@intel.com>
Wed, 23 Jul 2014 17:10:38 +0000 (10:10 -0700)
committerSage Weil <sage@redhat.com>
Tue, 21 Oct 2014 13:55:02 +0000 (06:55 -0700)
When closing journal, it should check must_write_header and update
journal header if must_write_header alreay set.
It can reduce the nosense journal-replay after restarting osd.

Signed-off-by: Ma Jianpeng <jianpeng.ma@intel.com>
Reviewed-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 5bf472aefb7360a1fe17601b42e551df120badfb)

src/os/FileJournal.cc

index 7eb7927e0412a476043e603d1d3110f826769424..5649e6da60504fcb0cd1892d6468a97ff6b92209 100644 (file)
@@ -544,6 +544,7 @@ void FileJournal::close()
 
   // close
   assert(writeq_empty());
+  assert(!must_write_header);
   assert(fd >= 0);
   VOID_TEMP_FAILURE_RETRY(::close(fd));
   fd = -1;
@@ -1102,7 +1103,7 @@ void FileJournal::write_thread_entry()
   while (1) {
     {
       Mutex::Locker locker(writeq_lock);
-      if (writeq.empty()) {
+      if (writeq.empty() && !must_write_header) {
        if (write_stop)
          break;
        dout(20) << "write_thread_entry going to sleep" << dendl;