OPTION(bluefs_max_log_runway, OPT_U64, 4194304) // alloc this much at a time
OPTION(bluefs_log_compact_min_ratio, OPT_FLOAT, 5.0) // before we consider
OPTION(bluefs_log_compact_min_size, OPT_U64, 16*1048576) // before we consider
+OPTION(bluefs_min_flush_size, OPT_U64, 65536) // ignore flush until its this big
OPTION(bluestore_bluefs, OPT_BOOL, true)
OPTION(bluestore_bluefs_env_mirror, OPT_BOOL, false) // mirror to normal Env for debug
log_file->fnode.size = bl.length();
log_writer = new FileWriter(log_file, bdev.size());
log_writer->append(bl);
- _flush(log_writer);
+ int r = _flush(log_writer, true);
+ assert(r == 0);
dout(10) << __func__ << " writing super" << dendl;
super.log_fnode = log_file->fnode;
log_t.seq = 0; // just so debug output is less confusing
_flush_bdev();
- int r = _flush(log_writer);
+ int r = _flush(log_writer, true);
assert(r == 0);
_flush_bdev();
return 0;
}
-int BlueFS::_flush(FileWriter *h)
+int BlueFS::_flush(FileWriter *h, bool force)
{
uint64_t length = h->buffer.length();
uint64_t offset = h->pos;
+ if (!force &&
+ length < g_conf->bluefs_min_flush_size) {
+ dout(10) << __func__ << " " << h << " ignoring, length " << length
+ << " < min_flush_size " << g_conf->bluefs_min_flush_size
+ << dendl;
+ return 0;
+ }
if (length == 0) {
if (h->file->dirty) {
dout(10) << __func__ << " " << h << " no data, flushing metadata on "
assert(0 == "actually this shouldn't happen");
}
if (h->buffer.length()) {
- int r = _flush(h);
+ int r = _flush(h, true);
if (r < 0)
return r;
}
void BlueFS::_fsync(FileWriter *h)
{
dout(10) << __func__ << " " << h << " " << h->file->fnode << dendl;
- _flush(h);
+ _flush(h, true);
if (h->file->dirty) {
_flush_log();
assert(!h->file->dirty);
int _allocate(unsigned bdev, uint64_t len, vector<bluefs_extent_t> *ev);
int _flush_range(FileWriter *h, uint64_t offset, uint64_t length);
- int _flush(FileWriter *h);
+ int _flush(FileWriter *h, bool force);
void _fsync(FileWriter *h);
int _flush_log();
void flush(FileWriter *h) {
Mutex::Locker l(lock);
- _flush(h);
+ _flush(h, false);
}
void flush_range(FileWriter *h, uint64_t offset, uint64_t length) {
Mutex::Locker l(lock);