]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: set mins on options to avoid unneeded max()
authorJohn Spray <john.spray@redhat.com>
Thu, 13 Jul 2017 17:14:59 +0000 (13:14 -0400)
committerJohn Spray <john.spray@redhat.com>
Fri, 21 Jul 2017 10:27:29 +0000 (06:27 -0400)
Signed-off-by: John Spray <john.spray@redhat.com>
src/common/options.cc
src/rgw/rgw_file.cc
src/rgw/rgw_rados.cc

index 3fb33ce8f8e06c26a40bdeb17d778e1c3377991c..e257fe79220507aee3d0bf16ed7ca793d1242db0 100644 (file)
@@ -4911,10 +4911,12 @@ const std::vector<Option> ceph_options = {
 
   Option("rgw_nfs_namespace_expire_secs", Option::TYPE_INT, Option::LEVEL_ADVANCED)
   .set_default(300)
+  .set_min(1)
   .set_description(""),
 
   Option("rgw_nfs_max_gc", Option::TYPE_INT, Option::LEVEL_ADVANCED)
   .set_default(300)
+  .set_min(1)
   .set_description(""),
 
   Option("rgw_nfs_write_completion_interval_s", Option::TYPE_INT, Option::LEVEL_ADVANCED)
@@ -4995,6 +4997,7 @@ const std::vector<Option> ceph_options = {
 
   Option("rgw_usage_max_user_shards", Option::TYPE_INT, Option::LEVEL_ADVANCED)
   .set_default(1)
+  .set_min(1)
   .set_description(""),
 
   Option("rgw_enable_ops_log", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
index bb98216cc56c433fc2fed48b2ffdbac44a195cea..83df3ddbf01bb94ede7be806e23b69f3006cf627 100644 (file)
@@ -839,8 +839,7 @@ namespace rgw {
       = get_context()->_conf->rgw_nfs_namespace_expire_secs;
 
     /* max events to gc in one cycle */
-    uint32_t max_ev =
-      std::max(int64_t(1), get_context()->_conf->rgw_nfs_max_gc);
+    uint32_t max_ev = get_context()->_conf->rgw_nfs_max_gc;
 
     struct timespec now, expire_ts;
     event_vector ve;
index c77432afe68df25a012095330f4cb6d24b61ad0a..566e5daeb1215c891978837310d6a7ca74b99414 100644 (file)
@@ -5034,12 +5034,12 @@ static void usage_log_hash(CephContext *cct, const string& name, string& hash, u
   uint32_t val = index;
 
   if (!name.empty()) {
-    int max_user_shards = max(cct->_conf->rgw_usage_max_user_shards, int64_t(1));
+    int max_user_shards = cct->_conf->rgw_usage_max_user_shards;
     val %= max_user_shards;
     val += ceph_str_hash_linux(name.c_str(), name.size());
   }
   char buf[17];
-  int max_shards = max(cct->_conf->rgw_usage_max_shards, int64_t(1));
+  int max_shards = cct->_conf->rgw_usage_max_shards;
   snprintf(buf, sizeof(buf), RGW_USAGE_OBJ_PREFIX "%u", (unsigned)(val % max_shards));
   hash = buf;
 }