]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: compact log even when sync_metadata sees no work 34876/head
authorSage Weil <sage@redhat.com>
Wed, 30 Aug 2017 02:07:05 +0000 (22:07 -0400)
committerIgor Fedotov <ifedotov@suse.com>
Tue, 5 May 2020 12:17:42 +0000 (15:17 +0300)
It's possible that when sync_metadata() is called there won't be any new
log data to flush because it was already flushed for other reasons (e.g.,
because fsync was called).  However, the log may still be large and in
need of compaction.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit dfe5f05f7948da6200229248a41dc1368737380e)

 Conflicts:
src/os/bluestore/BlueFS.cc
 Some pending release stuff that is now absent at both Luminous and
master.

src/os/bluestore/BlueFS.cc

index 230f677dbcd93d243290ad558d4aafc0e536d891..29224b2311aff4caf47255c00d2ebbd9c69f30b0 100644 (file)
@@ -2038,13 +2038,15 @@ void BlueFS::sync_metadata()
   std::unique_lock<std::mutex> l(lock);
   if (log_t.empty()) {
     dout(10) << __func__ << " - no pending log events" << dendl;
-    return;
+  } else {
+    dout(10) << __func__ << dendl;
+    utime_t start = ceph_clock_now();
+    flush_bdev(); // FIXME?
+    _flush_and_sync_log(l);
+    utime_t end = ceph_clock_now();
+    utime_t dur = end - start;
+    dout(10) << __func__ << " done in " << dur << dendl;
   }
-  dout(10) << __func__ << dendl;
-  utime_t start = ceph_clock_now();
-  flush_bdev(); // FIXME?
-  _flush_and_sync_log(l);
-  dout(10) << __func__ << " done in " << (ceph_clock_now() - start) << dendl;
 
   if (_should_compact_log()) {
     if (cct->_conf->bluefs_compact_log_sync) {
@@ -2053,10 +2055,6 @@ void BlueFS::sync_metadata()
       _compact_log_async(l);
     }
   }
-
-  utime_t end = ceph_clock_now();
-  utime_t dur = end - start;
-  dout(10) << __func__ << " done in " << dur << dendl;
 }
 
 int BlueFS::open_for_write(