summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2012-04-26 15:50:27 -0700
committerSage Weil <sage@newdream.net>2012-04-26 18:49:19 -0700
commit207eec65d5959a5ce1591f2bf5897dc5496b2d3e (patch)
tree3da00048b3c5a294434f243b4fe2bec674665e15
parent0188d9bb3266ead97aa402dfa7c34e28b40a1e5a (diff)
downloadceph-207eec65d5959a5ce1591f2bf5897dc5496b2d3e.tar.gz
osd: make map dedup optional
On by default. This trades CPU for memory. Some might have unlimited RAM and not care. Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r--src/common/config_opts.h1
-rw-r--r--src/osd/OSD.cc14
2 files changed, 9 insertions, 6 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index 0b2c54aeae9..f39a5f3307f 100644
--- a/src/common/config_opts.h
+++ b/src/common/config_opts.h
@@ -268,6 +268,7 @@ OPTION(osd_pool_default_crush_rule, OPT_INT, 0)
OPTION(osd_pool_default_size, OPT_INT, 2)
OPTION(osd_pool_default_pg_num, OPT_INT, 8)
OPTION(osd_pool_default_pgp_num, OPT_INT, 8)
+OPTION(osd_map_dedup, OPT_BOOL, true)
OPTION(osd_map_cache_max, OPT_INT, 250)
OPTION(osd_map_message_max, OPT_INT, 100) // max maps per MOSDMap message
OPTION(osd_op_threads, OPT_INT, 2) // 0 == no threading
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index 137b168a0bb..81143d580cd 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -3727,12 +3727,14 @@ OSDMapRef OSD::add_map(OSDMap *o)
if (map_cache.count(e) == 0) {
dout(10) << "add_map " << e << " " << o << dendl;
- // dedup against an existing map at nearby epoch
- map<epoch_t,OSDMapRef>::iterator p = map_cache.lower_bound(e);
- if (p == map_cache.end() && !map_cache.empty())
- p--;
- if (p != map_cache.end())
- OSDMap::dedup(p->second.get(), o);
+ if (g_conf->osd_map_dedup) {
+ // dedup against an existing map at nearby epoch
+ map<epoch_t,OSDMapRef>::iterator p = map_cache.lower_bound(e);
+ if (p == map_cache.end() && !map_cache.empty())
+ p--;
+ if (p != map_cache.end())
+ OSDMap::dedup(p->second.get(), o);
+ }
map_cache.insert(make_pair(e, OSDMapRef(o)));
} else {