]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Journaler: use new style options 17806/head
authorKefu Chai <kchai@redhat.com>
Tue, 19 Sep 2017 11:16:24 +0000 (19:16 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 22 Sep 2017 04:28:21 +0000 (12:28 +0800)
also use uint64_t for these options, as they are casted to uint64_t when
reading from conf.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/legacy_config_opts.h
src/common/options.cc
src/osdc/Journaler.cc

index 098a00c13633010f9e54effed67c008c2d9fd7a6..24c3f99ce3ef4c6e2492963867e8bc33afbbba48 100644 (file)
@@ -424,9 +424,6 @@ OPTION(filer_max_purge_ops, OPT_U32)
 // Max number of truncate at once in a single Filer::truncate call
 OPTION(filer_max_truncate_ops, OPT_U32)
 
-OPTION(journaler_write_head_interval, OPT_INT)
-OPTION(journaler_prefetch_periods, OPT_INT)   // * journal object size
-OPTION(journaler_prezero_periods, OPT_INT)     // * journal object size
 OPTION(mds_data, OPT_STR)
 OPTION(mds_max_file_size, OPT_U64) // Used when creating new CephFS. Change with 'ceph mds set max_file_size <size>' afterwards
 // max xattr kv pairs size for each dir/file
index 115c975840196d6ddd503c7a4cdf48177bc7a44b..7e3e171d3c423d7c1bc84f64e0325e32a6b95ffe 100644 (file)
@@ -1543,12 +1543,18 @@ std::vector<Option> get_global_options() {
     .set_default(15)
     .set_description("Interval in seconds between journal header updates (to help bound replay time)"),
 
-    Option("journaler_prefetch_periods", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    // * journal object size
+    Option("journaler_prefetch_periods", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(10)
+    .set_min(2)                        // we need at least 2 periods to make progress.
     .set_description("Number of striping periods to prefetch while reading MDS journal"),
 
-    Option("journaler_prezero_periods", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    // * journal object size
+    Option("journaler_prezero_periods", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(5)
+    // we need to zero at least two periods, minimum, to ensure that we
+    // have a full empty object/period in front of us.
+    .set_min(2)
     .set_description("Number of striping periods to zero head of MDS journal write position"),
 
     Option("osd_check_max_object_name_len_on_startup", Option::TYPE_BOOL, Option::LEVEL_DEV)
index fe9a6e9cdaf2b043942406e543ea9716fb3cf7fb..0896e70112d5b048d6807a6fae0f151dc365d39d 100644 (file)
@@ -90,9 +90,7 @@ void Journaler::_set_layout(file_layout_t const *l)
 
   // prefetch intelligently.
   // (watch out, this is big if you use big objects or weird striping)
-  uint64_t periods = cct->_conf->journaler_prefetch_periods;
-  if (periods < 2)
-    periods = 2;  // we need at least 2 periods to make progress.
+  uint64_t periods = cct->_conf->get_val<uint64_t>("journaler_prefetch_periods");
   fetch_len = layout.get_period() * periods;
 }
 
@@ -740,7 +738,7 @@ void Journaler::_flush(C_OnFinisher *onsafe)
 
 bool Journaler::_write_head_needed()
 {
-  return last_wrote_head + seconds(cct->_conf->journaler_write_head_interval)
+  return last_wrote_head + seconds(cct->_conf->get_val<int64_t>("journaler_write_head_interval"))
       < ceph::real_clock::now();
 }
 
@@ -761,10 +759,7 @@ void Journaler::_issue_prezero()
 {
   assert(prezeroing_pos >= flush_pos);
 
-  // we need to zero at least two periods, minimum, to ensure that we
-  // have a full empty object/period in front of us.
-  uint64_t num_periods = MAX(2, cct->_conf->journaler_prezero_periods);
-
+  uint64_t num_periods = cct->_conf->get_val<uint64_t>("journaler_prezero_periods");
   /*
    * issue zero requests based on write_pos, even though the invariant
    * is that we zero ahead of flush_pos.