OPTION(ebofs_max_prefetch, 0, OPT_INT, 1000), // 4k blocks
OPTION(ebofs_realloc, 0, OPT_BOOL, false), // hrm, this can cause bad fragmentation, don't use!
OPTION(ebofs_verify_csum_on_read, 0, OPT_BOOL, true),
- OPTION(journal_dio, 0, OPT_BOOL, false),
+ OPTION(journal_dio, 0, OPT_BOOL, true),
+ OPTION(journal_block_align, 0, OPT_BOOL, true),
OPTION(journal_max_write_bytes, 0, OPT_INT, 0),
OPTION(journal_max_write_entries, 0, OPT_INT, 100),
OPTION(bdev_lock, 0, OPT_BOOL, true),
int i;
config_option *opt;
+ memset(&g_conf, 0, sizeof(g_conf));
+
for (i = 0; i<len; i++) {
opt = &config_optionsp[i];
if (opt->val_ptr) {
// journal
bool journal_dio;
+ bool journal_block_align;
int journal_max_write_bytes;
int journal_max_write_entries;
if (forwrite) {
flags = O_RDWR;
- if (directio) flags |= O_DIRECT;
+ if (directio) flags |= O_DIRECT | O_SYNC;
} else {
flags = O_RDONLY;
}
memset(zero_buf, 0, header.alignment);
dout(2) << "_open " << fn << " fd " << fd
- << ": " << max_size << " bytes, block size " << block_size << dendl;
+ << ": " << max_size
+ << " bytes, block size " << block_size
+ << " bytes, directio = " << directio << dendl;
return 0;
}
header.fsid = fsid;
header.max_size = max_size;
header.block_size = block_size;
- if (directio)
+ if (g_conf.journal_block_align || directio)
header.alignment = block_size;
else
header.alignment = 16; // at least stay word aligned on 64bit machines...
<< (hbp.length() ? " + header":"")
<< dendl;
+ utime_t from = g_clock.now();
+
// header
if (hbp.length())
::pwrite(fd, hbp.c_str(), hbp.length(), 0);
pos += (*it).length();
}
if (!directio) {
- dout(20) << "do_write fsync start" << dendl;
+ dout(20) << "do_write fsync" << dendl;
#ifdef DARWIN
::fsync(fd);
#else
::fdatasync(fd);
+ //::sync_file_range(fd, write_pos, bl.length(),
+ //SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE|SYNC_FILE_RANGE_WAIT_AFTER);
#endif
- dout(20) << "do_write fsync finish" << dendl;
}
+ utime_t lat = g_clock.now() - from;
+ dout(20) << "do_write latency " << lat << dendl;
+
write_lock.Lock();
writing = false;
} write_thread;
off64_t get_top() {
- if (directio)
- return block_size;
- else
- return sizeof(header);
+ return ROUND_UP_TO(sizeof(header), block_size);
}
public: