From 5eeb70b1f1a61037afb56831212baf0b90625633 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 29 Aug 2017 22:07:05 -0400 Subject: [PATCH] os/bluestore/BlueFS: compact log even when sync_metadata sees no work 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 (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 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 230f677dbcd..29224b2311a 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -2038,13 +2038,15 @@ void BlueFS::sync_metadata() std::unique_lock 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( -- 2.47.3