]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore/BlueFS: do not start racing async compaction
authorSage Weil <sage@redhat.com>
Wed, 7 Sep 2016 19:29:30 +0000 (15:29 -0400)
committerSage Weil <sage@redhat.com>
Wed, 7 Sep 2016 19:29:30 +0000 (15:29 -0400)
Compaction is triggred from sync_metadata.  If one compaction is
in progress and another thread also calls sync_metadata, do not
trigger a second async compaction!

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueFS.cc

index 0e665ee5071469368de92760c7dd899d0a98b2bf..6e3aeb47676043706b0eb28aa789b05310601ff6 100644 (file)
@@ -998,10 +998,14 @@ bool BlueFS::_should_compact_log()
   float ratio = (float)current / (float)expected;
   dout(10) << __func__ << " current 0x" << std::hex << current
           << " expected " << expected << std::dec
-          << " ratio " << ratio << dendl;
-  if (current < g_conf->bluefs_log_compact_min_size ||
-      ratio < g_conf->bluefs_log_compact_min_ratio)
+          << " ratio " << ratio
+          << (log_flushing ? " (async compaction in progress)" : "")
+          << dendl;
+  if (log_flushing ||
+      current < g_conf->bluefs_log_compact_min_size ||
+      ratio < g_conf->bluefs_log_compact_min_ratio) {
     return false;
+  }
   return true;
 }