diff options
author | Samuel Just <sam.just@inktank.com> | 2013-05-06 19:56:50 +0200 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-06 22:05:01 +0200 |
commit | eb69c7df1902706b74876b6803ffcae68bd5ff76 (patch) | |
tree | ac5aaad6447d56c4e2d2783c000a9c781f424618 | |
parent | ceph-disk: use separate lock files for prepare, activate (diff) | |
download | ceph-eb69c7df1902706b74876b6803ffcae68bd5ff76.tar.xz ceph-eb69c7df1902706b74876b6803ffcae68bd5ff76.zip |
os/: default to dio for non-block journals
Workaround: #4910
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/common/config_opts.h | 1 | ||||
-rw-r--r-- | src/os/FileJournal.cc | 10 | ||||
-rw-r--r-- | src/os/FileJournal.h | 6 | ||||
-rw-r--r-- | src/os/FileStore.cc | 3 | ||||
-rw-r--r-- | src/os/FileStore.h | 2 |
5 files changed, 15 insertions, 7 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 84df2bff266..02ceda5703e 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -514,6 +514,7 @@ OPTION(filestore_replica_fadvise, OPT_BOOL, true) OPTION(filestore_debug_verify_split, OPT_BOOL, false) OPTION(journal_dio, OPT_BOOL, true) OPTION(journal_aio, OPT_BOOL, true) +OPTION(journal_force_aio, OPT_BOOL, false) // max bytes to search ahead in journal searching for corruption OPTION(journal_max_corrupt_search, OPT_U64, 10<<20) diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 1a3ce01d390..2418dbbd7cc 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -87,10 +87,16 @@ int FileJournal::_open(bool forwrite, bool create) goto out_fd; } - if (S_ISBLK(st.st_mode)) + if (S_ISBLK(st.st_mode)) { ret = _open_block_device(); - else + } else { + if (aio && !force_aio) { + derr << "FileJournal::_open: disabling aio for non-block journal. Use " + << "journal_force_aio to force use of aio anyway" << dendl; + aio = false; + } ret = _open_file(st.st_size, st.st_blksize, create); + } if (ret) goto out_fd; diff --git a/src/os/FileJournal.h b/src/os/FileJournal.h index 38e32324dca..c69fc54c282 100644 --- a/src/os/FileJournal.h +++ b/src/os/FileJournal.h @@ -222,7 +222,7 @@ private: off64_t max_size; size_t block_size; bool is_bdev; - bool directio, aio; + bool directio, aio, force_aio; bool must_write_header; off64_t write_pos; // byte where the next entry to be written will go off64_t read_pos; // @@ -351,7 +351,7 @@ private: } public: - FileJournal(uuid_d fsid, Finisher *fin, Cond *sync_cond, const char *f, bool dio=false, bool ai=true) : + FileJournal(uuid_d fsid, Finisher *fin, Cond *sync_cond, const char *f, bool dio=false, bool ai=true, bool faio=false) : Journal(fsid, fin, sync_cond), finisher_lock("FileJournal::finisher_lock", false, true, false, g_ceph_context), journaled_seq(0), @@ -362,7 +362,7 @@ private: fn(f), zero_buf(NULL), max_size(0), block_size(0), - is_bdev(false), directio(dio), aio(ai), + is_bdev(false), directio(dio), aio(ai), force_aio(faio), must_write_header(false), write_pos(0), read_pos(0), #ifdef HAVE_LIBAIO diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 9f13cff246b..0212a624e50 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -417,6 +417,7 @@ FileStore::FileStore(const std::string &base, const std::string &jdev, const cha do_update(do_update), m_journal_dio(g_conf->journal_dio), m_journal_aio(g_conf->journal_aio), + m_journal_force_aio(g_conf->journal_force_aio), m_osd_rollback_to_cluster_snap(g_conf->osd_rollback_to_cluster_snap), m_osd_use_stale_snap(g_conf->osd_use_stale_snap), m_filestore_queue_max_ops(g_conf->filestore_queue_max_ops), @@ -561,7 +562,7 @@ int FileStore::open_journal() if (journalpath.length()) { dout(10) << "open_journal at " << journalpath << dendl; journal = new FileJournal(fsid, &finisher, &sync_cond, journalpath.c_str(), - m_journal_dio, m_journal_aio); + m_journal_dio, m_journal_aio, m_journal_force_aio); if (journal) journal->logger = logger; } diff --git a/src/os/FileStore.h b/src/os/FileStore.h index ebe022561a5..d5ca2a4c237 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -524,7 +524,7 @@ private: bool m_filestore_fail_eio; bool m_filestore_replica_fadvise; int do_update; - bool m_journal_dio, m_journal_aio; + bool m_journal_dio, m_journal_aio, m_journal_force_aio; std::string m_osd_rollback_to_cluster_snap; bool m_osd_use_stale_snap; int m_filestore_queue_max_ops; |