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();
<< " 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
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;
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);