]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: set default cache_target_{dirty,full}_ratios based on configurable
authorSage Weil <sage@inktank.com>
Mon, 10 Mar 2014 20:52:54 +0000 (13:52 -0700)
committerSage Weil <sage@inktank.com>
Thu, 13 Mar 2014 23:38:35 +0000 (16:38 -0700)
These were hard-coded in the pg_pool_t constructor, but that was a dumb
idea.

Note that decoding legacy pg_pool_t's no longer does what it used to.  I'm
pretty sure that's okay since we care less about interim releases and
because we are pulling these normally out of OSDMap, which is freshly
encoded on a regular basis (and certainly recently with real values). Also,
let's not forget that this field is meaningless on old pools anyway.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/mon/OSDMonitor.cc
src/osd/osd_types.cc
src/osd/osd_types.h

index b254aaf43cf7002fbc6fb9b2750d1341bb0e33f1..e918c3bf0f3f008bbaacb3046c2e96ef26602a17 100644 (file)
@@ -430,6 +430,8 @@ OPTION(osd_pool_default_erasure_code_properties,
 OPTION(osd_pool_default_flags, OPT_INT, 0)   // default flags for new pools
 OPTION(osd_pool_default_flag_hashpspool, OPT_BOOL, true)   // use new pg hashing to prevent pool/pg overlap
 OPTION(osd_pool_default_hit_set_bloom_fpp, OPT_FLOAT, .05)
+OPTION(osd_pool_default_cache_target_dirty_ratio, OPT_FLOAT, .4)
+OPTION(osd_pool_default_cache_target_full_ratio, OPT_FLOAT, .8)
 OPTION(osd_hit_set_min_size, OPT_INT, 1000)  // min target size for a HitSet
 OPTION(osd_hit_set_namespace, OPT_STR, ".ceph-internal") // rados namespace for hit_set tracking
 
index 8a6715a071741231dcc95a34edec37efdd713605..5af8e5355ccce7e720fced0c562de5c0c019435f 100644 (file)
@@ -3034,6 +3034,10 @@ int OSDMonitor::prepare_new_pool(string& name, uint64_t auid, int crush_ruleset,
   pi->auid = auid;
   pi->properties = properties_map;
   pi->stripe_width = stripe_width;
+  pi->cache_target_dirty_ratio_micro =
+    g_conf->osd_pool_default_cache_target_dirty_ratio * 1000000;
+  pi->cache_target_full_ratio_micro =
+    g_conf->osd_pool_default_cache_target_full_ratio * 1000000;
   pending_inc.new_pool_names[pool] = name;
   return 0;
 }
index f26a0da0740637dd55e0e0155859acc8a6c4abce..9e6a8f660d0ecd8f8087418a9f25c3e739bc555d 100644 (file)
@@ -1178,13 +1178,12 @@ void pg_pool_t::decode(bufferlist::iterator& bl)
     ::decode(cache_min_flush_age, bl);
     ::decode(cache_min_evict_age, bl);
   } else {
-    pg_pool_t def;
-    target_max_bytes = def.target_max_bytes;
-    target_max_objects = def.target_max_objects;
-    cache_target_dirty_ratio_micro = def.cache_target_dirty_ratio_micro;
-    cache_target_full_ratio_micro = def.cache_target_full_ratio_micro;
-    cache_min_flush_age = def.cache_min_flush_age;
-    cache_min_evict_age = def.cache_min_evict_age;
+    target_max_bytes = 0;
+    target_max_objects = 0;
+    cache_target_dirty_ratio_micro = 0;
+    cache_target_full_ratio_micro = 0;
+    cache_min_flush_age = 0;
+    cache_min_evict_age = 0;
   }
 
   DECODE_FINISH(bl);
index dcb0c2a161a110ce2f2e9a4903960d51acb737dc..955fb6caccddb5d9ccc6e54cfed783efcbadb040 100644 (file)
@@ -943,8 +943,8 @@ public:
       tier_of(-1), read_tier(-1), write_tier(-1),
       cache_mode(CACHEMODE_NONE),
       target_max_bytes(0), target_max_objects(0),
-      cache_target_dirty_ratio_micro(400000),
-      cache_target_full_ratio_micro(800000),
+      cache_target_dirty_ratio_micro(0),
+      cache_target_full_ratio_micro(0),
       cache_min_flush_age(0),
       cache_min_evict_age(0),
       hit_set_params(),