]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: treat config ints as 64 bit
authorJohn Spray <john.spray@redhat.com>
Tue, 11 Jul 2017 18:24:26 +0000 (14:24 -0400)
committerJohn Spray <john.spray@redhat.com>
Fri, 21 Jul 2017 10:27:26 +0000 (06:27 -0400)
In the new world, all int config values are 64 bit.  When
doing a min() like this, need both sides in the same type.

Signed-off-by: John Spray <john.spray@redhat.com>
src/rgw/librgw.cc
src/rgw/rgw_file.cc
src/rgw/rgw_gc.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 306dbf35f854bba959046164e2f0685423937278..90559f2d351eb906158323aa61c2d777e4b737f4 100644 (file)
@@ -103,7 +103,7 @@ namespace rgw {
       auto expire_s = cct->_conf->rgw_nfs_namespace_expire_secs;
 
       /* delay between gc cycles */
-      auto delay_s = std::max(1, std::min(MIN_EXPIRE_S, expire_s/2));
+      auto delay_s = std::max(int64_t(1), std::min(int64_t(MIN_EXPIRE_S), expire_s/2));
 
       unique_lock uniq(mtx);
     restart:
index 5ef4c7bb6978ea78777688fe6346dae05857dd4a..bb98216cc56c433fc2fed48b2ffdbac44a195cea 100644 (file)
@@ -840,7 +840,7 @@ namespace rgw {
 
     /* max events to gc in one cycle */
     uint32_t max_ev =
-      std::max(1, get_context()->_conf->rgw_nfs_max_gc);
+      std::max(int64_t(1), get_context()->_conf->rgw_nfs_max_gc);
 
     struct timespec now, expire_ts;
     event_vector ve;
index 67b8a5c33dfcccec377a1c571e5d489e85d6c987..e29af16ed1762379f302745a141d31aef819b6e8 100644 (file)
@@ -24,7 +24,7 @@ void RGWGC::initialize(CephContext *_cct, RGWRados *_store) {
   cct = _cct;
   store = _store;
 
-  max_objs = min(cct->_conf->rgw_gc_max_objs, rgw_shards_max());
+  max_objs = min(static_cast<int>(cct->_conf->rgw_gc_max_objs), rgw_shards_max());
 
   obj_names = new string[max_objs];
 
index a353290457554d977c8d538cd55bbc2235720da7..c77432afe68df25a012095330f4cb6d24b61ad0a 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, 1);
+    int max_user_shards = max(cct->_conf->rgw_usage_max_user_shards, int64_t(1));
     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, 1);
+  int max_shards = max(cct->_conf->rgw_usage_max_shards, int64_t(1));
   snprintf(buf, sizeof(buf), RGW_USAGE_OBJ_PREFIX "%u", (unsigned)(val % max_shards));
   hash = buf;
 }
@@ -5540,7 +5540,8 @@ int RGWRados::Bucket::update_bucket_id(const string& new_bucket_id)
  * common_prefixes: if delim is filled in, any matching prefixes are placed here.
  * is_truncated: if number of objects in the bucket is bigger than max, then truncated.
  */
-int RGWRados::Bucket::List::list_objects(int max, vector<rgw_bucket_dir_entry> *result,
+int RGWRados::Bucket::List::list_objects(int64_t max,
+                                         vector<rgw_bucket_dir_entry> *result,
                                          map<string, bool> *common_prefixes,
                                          bool *is_truncated)
 {
index ad68b4c82780c0f551bbf30dcad08f0734d375a5..0e2b052b7d5bd45c16dcd18cbdc490933f94d0c6 100644 (file)
@@ -2986,7 +2986,7 @@ public:
     public:
       explicit List(RGWRados::Bucket *_target) : target(_target) {}
 
-      int list_objects(int max, vector<rgw_bucket_dir_entry> *result, map<string, bool> *common_prefixes, bool *is_truncated);
+      int list_objects(int64_t max, vector<rgw_bucket_dir_entry> *result, map<string, bool> *common_prefixes, bool *is_truncated);
       rgw_obj_key& get_next_marker() {
         return next_marker;
       }