]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore/BlueFS: Helper functions for the unit test framework
authorVarada Kari <varada.kari@sandisk.com>
Fri, 22 Jul 2016 11:02:15 +0000 (16:32 +0530)
committerSage Weil <sage@redhat.com>
Sat, 13 Aug 2016 15:49:39 +0000 (11:49 -0400)
Signed-off-by: Varada Kari <varada.kari@sandisk.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h

index 3d9a7871458692db660442713d7f6af7be15c158..377aedb68c5511fa3c8c12bf4f8be2d41bf73161 100644 (file)
@@ -973,6 +973,16 @@ uint64_t BlueFS::_estimate_log_size()
   return ROUND_UP_TO(size, super.block_size);
 }
 
+void BlueFS::compact_log()
+{
+  std::unique_lock<std::mutex> l(lock);
+  if (g_conf->bluefs_compact_log_sync) {
+     _compact_log_sync();
+  } else {
+    _compact_log_async(l);
+  }
+}
+
 bool BlueFS::_should_compact_log()
 {
   uint64_t current = log_writer->file->fnode.size;
@@ -1230,6 +1240,12 @@ void BlueFS::_pad_bl(bufferlist& bl)
   }
 }
 
+void BlueFS::flush_log()
+{
+  std::unique_lock<std::mutex> l(lock);
+  _flush_and_sync_log(l);
+}
+
 int BlueFS::_flush_and_sync_log(std::unique_lock<std::mutex>& l,
                                uint64_t want_seq,
                                uint64_t jump_to)
index dd8b5786c37d49758916924b4601622dc091f1b3..e1ff8575b7e6a3fa7da94c474f18672e0c686807 100644 (file)
@@ -342,6 +342,9 @@ public:
   int lock_file(const string& dirname, const string& filename, FileLock **p);
   int unlock_file(FileLock *l);
 
+  void flush_log();
+  void compact_log();
+
   /// sync any uncommitted state to disk
   int sync();