Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/filestore: disable use of splice by default #11113

Merged
merged 1 commit into from Sep 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/config_opts.h
Expand Up @@ -1104,6 +1104,7 @@ OPTION(filestore_fsync_flushes_journal_data, OPT_BOOL, false)
OPTION(filestore_fiemap, OPT_BOOL, false) // (try to) use fiemap
OPTION(filestore_punch_hole, OPT_BOOL, false)
OPTION(filestore_seek_data_hole, OPT_BOOL, false) // (try to) use seek_data/hole
OPTION(filestore_splice, OPT_BOOL, false)
OPTION(filestore_fadvise, OPT_BOOL, true)
//collect device partition information for management application to use
OPTION(filestore_collect_device_partition_information, OPT_BOOL, true)
Expand Down
8 changes: 6 additions & 2 deletions src/os/filestore/GenericFileStoreBackend.cc
Expand Up @@ -58,10 +58,11 @@ GenericFileStoreBackend::GenericFileStoreBackend(FileStore *fs):
FileStoreBackend(fs),
ioctl_fiemap(false),
seek_data_hole(false),
use_splice(false),
m_filestore_fiemap(g_conf->filestore_fiemap),
m_filestore_seek_data_hole(g_conf->filestore_seek_data_hole),
m_filestore_fsync_flushes_journal_data(g_conf->filestore_fsync_flushes_journal_data),
m_filestore_splice(false) {}
m_filestore_splice(g_conf->filestore_splice) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this actually change the behavior? it's going from false to (tunable) false.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the detection code in GenericFileStoreBackend.cc shoudl only run if it's true (instead of false) and disable if it's not detected (vs enable if it is).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I found the detection in _detect_feature is wrong.... I update _detect_feature too. Otherwise it will enable splice when m_filestore_splice is false....


int GenericFileStoreBackend::detect_features()
{
Expand Down Expand Up @@ -165,6 +166,9 @@ int GenericFileStoreBackend::detect_features()
//splice detection
#ifdef CEPH_HAVE_SPLICE
if (!m_filestore_splice) {
dout(0) << __func__ << ": splice() is disabled via 'filestore splice' config option" << dendl;
use_splice = false;
} else {
int pipefd[2];
loff_t off_in = 0;
int r;
Expand All @@ -174,7 +178,7 @@ int GenericFileStoreBackend::detect_features()
lseek(fd, 0, SEEK_SET);
r = splice(fd, &off_in, pipefd[1], NULL, 10, 0);
if (!(r < 0 && errno == EINVAL)) {
m_filestore_splice = true;
use_splice = true;
dout(0) << "detect_features: splice is supported" << dendl;
} else
dout(0) << "detect_features: splice is NOT supported" << dendl;
Expand Down
3 changes: 2 additions & 1 deletion src/os/filestore/GenericFileStoreBackend.h
Expand Up @@ -23,6 +23,7 @@ class GenericFileStoreBackend : public FileStoreBackend {
private:
bool ioctl_fiemap;
bool seek_data_hole;
bool use_splice;
bool m_filestore_fiemap;
bool m_filestore_seek_data_hole;
bool m_filestore_fsync_flushes_journal_data;
Expand Down Expand Up @@ -50,7 +51,7 @@ class GenericFileStoreBackend : public FileStoreBackend {
return _copy_range(from, to, srcoff, len, dstoff);
}
virtual int set_alloc_hint(int fd, uint64_t hint) { return -EOPNOTSUPP; }
virtual bool has_splice() const { return m_filestore_splice; }
virtual bool has_splice() const { return use_splice; }
private:
int _crc_load_or_init(int fd, SloppyCRCMap *cm);
int _crc_save(int fd, SloppyCRCMap *cm);
Expand Down