From: Sage Weil Date: Wed, 7 Sep 2016 19:29:30 +0000 (-0400) Subject: os/bluestore/BlueFS: do not start racing async compaction X-Git-Tag: v11.0.1~293^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dbe23c94c0074358380a40d47a417f7999920696;p=ceph.git os/bluestore/BlueFS: do not start racing async compaction 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 --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 0e665ee507146..6e3aeb4767604 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -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; }