]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Add filestore_replica_fadvise config option default true
authorDavid Zafman <david.zafman@inktank.com>
Fri, 8 Mar 2013 02:02:07 +0000 (18:02 -0800)
committerDavid Zafman <david.zafman@inktank.com>
Fri, 8 Mar 2013 04:00:13 +0000 (20:00 -0800)
Signed-off-by: David Zafman <david.zafman@inktank.com>
Reviewed-by: Sam Just <sam.just@inktank.com>
src/common/config_opts.h
src/os/FileStore.cc
src/os/FileStore.h

index c72530e0aa8fe58db3056e94cbc979e67a449bb4..6e777adb2a7335179d89f4cf0a9861aa3a683c69 100644 (file)
@@ -466,6 +466,7 @@ OPTION(filestore_dump_file, OPT_STR, "")         // file onto which store transa
 OPTION(filestore_kill_at, OPT_INT, 0)            // inject a failure at the n'th opportunity
 OPTION(filestore_inject_stall, OPT_INT, 0)       // artificially stall for N seconds in op queue thread
 OPTION(filestore_fail_eio, OPT_BOOL, true)       // fail/crash on EIO
+OPTION(filestore_replica_fadvise, OPT_BOOL, true)
 OPTION(journal_dio, OPT_BOOL, true)
 OPTION(journal_aio, OPT_BOOL, false)
 OPTION(journal_block_align, OPT_BOOL, true)
index c15450b6429580e7611bbda8e9ba697d144944b4..49d95a227c97bd94dde266f16ac87267082bcc71 100644 (file)
@@ -407,6 +407,7 @@ FileStore::FileStore(const std::string &base, const std::string &jdev, const cha
   m_filestore_max_sync_interval(g_conf->filestore_max_sync_interval),
   m_filestore_min_sync_interval(g_conf->filestore_min_sync_interval),
   m_filestore_fail_eio(g_conf->filestore_fail_eio),
+  m_filestore_replica_fadvise(g_conf->filestore_replica_fadvise),
   do_update(do_update),
   m_journal_dio(g_conf->journal_dio),
   m_journal_aio(g_conf->journal_aio),
@@ -2929,7 +2930,7 @@ int FileStore::_write(coll_t cid, const hobject_t& oid,
       local_flush = true;
     }
 #endif
-    if (local_flush && replica) {
+    if (local_flush && replica && m_filestore_replica_fadvise) {
       int fa_r = posix_fadvise(fd, offset, len, POSIX_FADV_DONTNEED);
       if (fa_r) {
        dout(0) << "posic_fadvise failed: " << cpp_strerror(fa_r) << dendl;
@@ -3281,7 +3282,7 @@ void FileStore::flusher_entry()
        if (!stop && ep == sync_epoch) {
          dout(10) << "flusher_entry flushing+closing " << fd << " ep " << ep << dendl;
          ::sync_file_range(fd, off, len, SYNC_FILE_RANGE_WRITE);
-         if (replica) {
+         if (replica && m_filestore_replica_fadvise) {
            int fa_r = posix_fadvise(fd, off, len, POSIX_FADV_DONTNEED);
            if (fa_r) {
              dout(0) << "posic_fadvise failed: " << cpp_strerror(fa_r) << dendl;
@@ -4774,6 +4775,7 @@ const char** FileStore::get_tracked_conf_keys() const
     "filestore_dump_file",
     "filestore_kill_at",
     "filestore_fail_eio",
+    "filestore_replica_fadvise",
     NULL
   };
   return KEYS;
@@ -4792,7 +4794,8 @@ void FileStore::handle_conf_change(const struct md_config_t *conf,
       changed.count("filestore_flusher_max_fds") ||
       changed.count("filestore_flush_min") ||
       changed.count("filestore_kill_at") ||
-      changed.count("filestore_fail_eio")) {
+      changed.count("filestore_fail_eio") ||
+      changed.count("filestore_replica_fadvise")) {
     Mutex::Locker l(lock);
     m_filestore_min_sync_interval = conf->filestore_min_sync_interval;
     m_filestore_max_sync_interval = conf->filestore_max_sync_interval;
@@ -4806,6 +4809,7 @@ void FileStore::handle_conf_change(const struct md_config_t *conf,
     m_filestore_sync_flush = conf->filestore_sync_flush;
     m_filestore_kill_at.set(conf->filestore_kill_at);
     m_filestore_fail_eio = conf->filestore_fail_eio;
+    m_filestore_replica_fadvise = conf->filestore_replica_fadvise;
   }
   if (changed.count("filestore_commit_timeout")) {
     Mutex::Locker l(sync_entry_timeo_lock);
index d7c69837e403cd30bf1184d164a8944c57306048..94c34c1fee17400f920561bc99657c1fff802c66 100644 (file)
@@ -501,6 +501,7 @@ private:
   double m_filestore_max_sync_interval;
   double m_filestore_min_sync_interval;
   bool m_filestore_fail_eio;
+  bool m_filestore_replica_fadvise;
   int do_update;
   bool m_journal_dio, m_journal_aio;
   std::string m_osd_rollback_to_cluster_snap;