]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: _should_compact_log
authorSage Weil <sage@redhat.com>
Wed, 22 Jun 2016 19:20:55 +0000 (15:20 -0400)
committerSage Weil <sage@redhat.com>
Fri, 12 Aug 2016 19:38:37 +0000 (15:38 -0400)
Signed-off-by: Varada Kari <varada.kari@sandisk.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h

index 8fe5e80463d1700ea3d23f34bf1f22e9b223f169..31548d971d3ae24b11e40e608c8a69982ea6bfe4 100644 (file)
@@ -918,7 +918,8 @@ uint64_t BlueFS::_estimate_log_size()
   return ROUND_UP_TO(size, super.block_size);
 }
 
-void BlueFS::_maybe_compact_log()
+
+bool BlueFS::_should_compact_log()
 {
   uint64_t current = log_writer->file->fnode.size;
   uint64_t expected = _estimate_log_size();
@@ -928,13 +929,11 @@ void BlueFS::_maybe_compact_log()
           << " ratio " << ratio << dendl;
   if (current < g_conf->bluefs_log_compact_min_size ||
       ratio < g_conf->bluefs_log_compact_min_ratio)
-    return;
-  _compact_log();
-  dout(20) << __func__ << " done, actual " << log_writer->file->fnode.size
-          << " vs expected " << expected << dendl;
+    return false;
+  return true;
 }
 
-void BlueFS::_compact_log()
+void BlueFS::_compact_log_sync()
 {
   // FIXME: we currently hold the lock while writing out the compacted log,
   // which may mean a latency spike.  we could drop the lock while writing out
@@ -1448,7 +1447,9 @@ void BlueFS::sync_metadata()
       p->commit_finish();
     }
   }
-  _maybe_compact_log();
+  if (_should_compact_log()) {
+    _compact_log_sync();
+  }
   utime_t end = ceph_clock_now(NULL);
   utime_t dur = end - start;
   dout(10) << __func__ << " done in " << dur << dendl;
index e7c29cbf2df93022bf348e7fac7f6600a82bdab0..fbd1e10408eb2680c503f560bab8d2f211de1c8b 100644 (file)
@@ -241,8 +241,8 @@ private:
   int _flush_and_sync_log(std::unique_lock<std::mutex>& l,
                          uint64_t want_seq = 0);
   uint64_t _estimate_log_size();
-  void _maybe_compact_log();
-  void _compact_log();
+  bool _should_compact_log();
+  void _compact_log_sync();
 
   //void _aio_finish(void *priv);