OPTION(filestore_btrfs_trans, 0, OPT_BOOL, true),
OPTION(filestore_btrfs_snap, 0, OPT_BOOL, false),
OPTION(filestore_btrfs_clone_range, 0, OPT_BOOL, true),
+ OPTION(filestore_fsync_flushes_journal_data, 0, OPT_BOOL, false),
OPTION(filestore_flusher, 0, OPT_BOOL, true),
OPTION(filestore_flusher_max_fds, 0, OPT_INT, 512),
OPTION(filestore_sync_flush, 0, OPT_BOOL, false),
bool filestore_btrfs_trans;
bool filestore_btrfs_snap;
bool filestore_btrfs_clone_range;
+ bool filestore_fsync_flushes_journal_data;
bool filestore_flusher;
int filestore_flusher_max_fds;
bool filestore_sync_flush;
}
}
- // btrfs?
int fd = ::open(basedir.c_str(), O_RDONLY);
if (fd < 0)
return -errno;
struct statfs st;
int r = ::fstatfs(fd, &st);
- if (r == 0 && st.f_type == 0x9123683E) {
+ if (r < 0)
+ return -errno;
+
+ if (st.f_type == 0x9123683E) {
dout(0) << "mount detected btrfs" << dendl;
btrfs = true;
dout(15) << "sync_entry doing btrfs sync" << dendl;
// do a full btrfs commit
::ioctl(op_fd, BTRFS_IOC_SYNC);
- } else {
+ } else if (g_conf.filestore_fsync_flushes_journal_data) {
dout(15) << "sync_entry doing fsync on " << current_op_seq_fn << dendl;
// make the file system's journal commit.
// this works with ext3, but NOT ext4
::fsync(op_fd);
+ } else {
+ dout(15) << "sync_entry doing a full sync (!)" << dendl;
+ ::sync();
}
}