From 5e8b37245e3b3420c1311c58122b88f5a0f593c3 Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 11 Jul 2017 14:24:26 -0400 Subject: [PATCH] rgw: treat config ints as 64 bit 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 --- src/rgw/librgw.cc | 2 +- src/rgw/rgw_file.cc | 2 +- src/rgw/rgw_gc.cc | 2 +- src/rgw/rgw_rados.cc | 7 ++++--- src/rgw/rgw_rados.h | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc index 306dbf35f85..90559f2d351 100644 --- a/src/rgw/librgw.cc +++ b/src/rgw/librgw.cc @@ -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: diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 5ef4c7bb697..bb98216cc56 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -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; diff --git a/src/rgw/rgw_gc.cc b/src/rgw/rgw_gc.cc index 67b8a5c33df..e29af16ed17 100644 --- a/src/rgw/rgw_gc.cc +++ b/src/rgw/rgw_gc.cc @@ -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(cct->_conf->rgw_gc_max_objs), rgw_shards_max()); obj_names = new string[max_objs]; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index a3532904575..c77432afe68 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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 *result, +int RGWRados::Bucket::List::list_objects(int64_t max, + vector *result, map *common_prefixes, bool *is_truncated) { diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index ad68b4c8278..0e2b052b7d5 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -2986,7 +2986,7 @@ public: public: explicit List(RGWRados::Bucket *_target) : target(_target) {} - int list_objects(int max, vector *result, map *common_prefixes, bool *is_truncated); + int list_objects(int64_t max, vector *result, map *common_prefixes, bool *is_truncated); rgw_obj_key& get_next_marker() { return next_marker; } -- 2.39.5