From 398a229c0ed66b37fe53fcc4217e3c6c9354c895 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 7 May 2012 14:37:38 -0700 Subject: [PATCH] filestore: set min flush size If a write is smaller than some threshold, do not bother to flush it; let the fs do that (efficiently, we hope) at commit time. Focus on the big writes. Signed-off-by: Sage Weil --- src/common/config_opts.h | 1 + src/os/FileStore.cc | 5 ++++- src/os/FileStore.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index b671807d27ba..c5f182e0dbc6 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -353,6 +353,7 @@ OPTION(filestore_fsync_flushes_journal_data, OPT_BOOL, false) OPTION(filestore_fiemap, OPT_BOOL, false) // (try to) use fiemap OPTION(filestore_flusher, OPT_BOOL, true) OPTION(filestore_flusher_max_fds, OPT_INT, 512) +OPTION(filestore_flush_min, OPT_INT, 65536) OPTION(filestore_sync_flush, OPT_BOOL, false) OPTION(filestore_journal_parallel, OPT_BOOL, false) OPTION(filestore_journal_writeahead, OPT_BOOL, false) diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 2f88157461cf..bd88c8f0201c 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -700,6 +700,7 @@ FileStore::FileStore(const std::string &base, const std::string &jdev, const cha m_filestore_fiemap_threshold(g_conf->filestore_fiemap_threshold), m_filestore_sync_flush(g_conf->filestore_sync_flush), m_filestore_flusher_max_fds(g_conf->filestore_flusher_max_fds), + m_filestore_flush_min(g_conf->filestore_flush_min), m_filestore_max_sync_interval(g_conf->filestore_max_sync_interval), m_filestore_min_sync_interval(g_conf->filestore_min_sync_interval), do_update(do_update), @@ -3112,7 +3113,7 @@ int FileStore::_write(coll_t cid, const hobject_t& oid, r = bl.length(); // flush? - if ( + if ((ssize_t)len < m_filestore_flush_min || #ifdef HAVE_SYNC_FILE_RANGE !m_filestore_flusher || !queue_flusher(fd, offset, len) #else @@ -4673,12 +4674,14 @@ void FileStore::handle_conf_change(const struct md_config_t *conf, if (changed.count("filestore_min_sync_interval") || changed.count("filestore_max_sync_interval") || changed.count("filestore_flusher_max_fds") || + changed.count("filestore_flush_min") || changed.count("filestore_kill_at")) { Mutex::Locker l(lock); m_filestore_min_sync_interval = conf->filestore_min_sync_interval; m_filestore_max_sync_interval = conf->filestore_max_sync_interval; m_filestore_flusher = conf->filestore_flusher; m_filestore_flusher_max_fds = conf->filestore_flusher_max_fds; + m_filestore_flush_min = conf->filestore_flush_min; m_filestore_sync_flush = conf->filestore_sync_flush; m_filestore_kill_at.set(conf->filestore_kill_at); } diff --git a/src/os/FileStore.h b/src/os/FileStore.h index e98301c67bba..9b865751998b 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -485,6 +485,7 @@ private: int m_filestore_fiemap_threshold; bool m_filestore_sync_flush; int m_filestore_flusher_max_fds; + int m_filestore_flush_min; double m_filestore_max_sync_interval; double m_filestore_min_sync_interval; int do_update; -- 2.47.3