]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
build: 32 bit architecture fixes 23485/head
authorJames Page <james.page@ubuntu.com>
Tue, 7 Aug 2018 13:06:05 +0000 (14:06 +0100)
committerJames Page <james.page@ubuntu.com>
Wed, 8 Aug 2018 11:07:48 +0000 (12:07 +0100)
Misc fixes to resolve compilation failures on 32 bit
architectures.  These are mostly due to differences
in types under 32 bit archs which are typically fixed
by switching to a type which is consistent between
architectures - size_t -> uint64_t for example.

Signed-off-by: James Page <james.page@ubuntu.com>
src/common/ceph_context.h
src/mon/OSDMonitor.cc
src/os/bluestore/BlueStore.cc
src/osd/PrimaryLogPG.cc
src/rgw/rgw_sync_log_trim.cc
src/test/rbd_mirror/test_ImageSync.cc

index 0c2c64878715a8d231af9917d35f4bd2e72f81a6..88318bce3f805153c39772e327ade44bc4b7945a 100644 (file)
@@ -143,7 +143,7 @@ public:
   void do_command(std::string_view command, const cmdmap_t& cmdmap,
                  std::string_view format, ceph::bufferlist *out);
 
-  static constexpr std::size_t largest_singleton = sizeof(void*) * 72;
+  static constexpr std::size_t largest_singleton = 8 * 72;
 
   template<typename T, typename... Args>
   T& lookup_or_create_singleton_object(std::string_view name,
index 02900318feedc2432996ebae9d56116377416eca..f6129a3e21b3af075f4d8b411cd09bd2546446ae 100644 (file)
@@ -826,8 +826,8 @@ OSDMonitor::update_pending_pgs(const OSDMap::Incremental& inc,
             << " modified " << p->second.modified
             << " [" << p->second.start << "-" << p->second.end << ")"
             << dendl;
-    int n = std::min(max - pending_creatings.pgs.size(),
-               p->second.end - p->second.start);
+    int64_t n = std::min<int64_t>(max - pending_creatings.pgs.size(),
+                                 p->second.end - p->second.start);
     ps_t first = p->second.start;
     ps_t end = first + n;
     for (ps_t ps = first; ps < end; ++ps) {
index 42318ab811143e929b08c648c39ea803b36eaa0a..d7ee82e51eb31482218d20113d1e4bcd203314c2 100644 (file)
@@ -12328,8 +12328,8 @@ size_t BlueStoreRepairer::StoreSpaceTracker::filter_out(
   assert(!was_filtered_out);
   assert(collections_bfs.size() == objects_bfs.size());
 
-  size_t prev_pos = 0;
-  size_t npos = collections_bfs.size();
+  uint64_t prev_pos = 0;
+  uint64_t npos = collections_bfs.size();
 
   bloom_vector collections_reduced;
   bloom_vector objects_reduced;
@@ -12338,8 +12338,8 @@ size_t BlueStoreRepairer::StoreSpaceTracker::filter_out(
     if (e.second == 0) {
       continue;
     }
-    size_t pos = max(e.first / granularity, prev_pos);
-    size_t end_pos = 1 + (e.first + e.second - 1) / granularity;
+    uint64_t pos = max(e.first / granularity, prev_pos);
+    uint64_t end_pos = 1 + (e.first + e.second - 1) / granularity;
     while (pos != npos && pos < end_pos)  {
         assert( collections_bfs[pos].element_count() ==
           objects_bfs[pos].element_count());
index 4d3e131c0a30bbf415dc8847a2100ae241bc044e..681243ae08d00900f21b922f98c6f51f3aa1b56a 100644 (file)
@@ -1634,8 +1634,8 @@ void PrimaryLogPG::calc_trim_to()
       pg_log.get_log().approx_size() > target) {
     dout(10) << __func__ << " approx pg log length =  "
              << pg_log.get_log().approx_size() << dendl;
-    size_t num_to_trim = std::min(pg_log.get_log().approx_size() - target,
-                                 cct->_conf->osd_pg_log_trim_max);
+    uint64_t num_to_trim = std::min<uint64_t>(pg_log.get_log().approx_size() - target,
+                                              cct->_conf->osd_pg_log_trim_max);
     dout(10) << __func__ << " num_to_trim =  " << num_to_trim << dendl;
     if (num_to_trim < cct->_conf->osd_pg_log_trim_min &&
        cct->_conf->osd_pg_log_trim_max >= cct->_conf->osd_pg_log_trim_min) {
@@ -1643,7 +1643,7 @@ void PrimaryLogPG::calc_trim_to()
     }
     list<pg_log_entry_t>::const_iterator it = pg_log.get_log().log.begin();
     eversion_t new_trim_to;
-    for (size_t i = 0; i < num_to_trim; ++i) {
+    for (uint64_t i = 0; i < num_to_trim; ++i) {
       new_trim_to = it->version;
       ++it;
       if (new_trim_to >= limit) {
index f190a432c1ce77fb6033e0d844e8608f89fbf767..69deff51cb19d5c2d45dcb6a7c877aeb60f27ab1 100644 (file)
@@ -351,7 +351,7 @@ int take_min_status(CephContext *cct, Iter first, Iter last,
   status->clear();
   // The initialisation below is required to silence a false positive
   // -Wmaybe-uninitialized warning
-  boost::optional<size_t> num_shards = boost::make_optional(false, 0UL);
+  boost::optional<uint64_t> num_shards = boost::make_optional(false, uint64_t());
   for (auto peer = first; peer != last; ++peer) {
     const size_t peer_shards = peer->size();
     if (!num_shards) {
index 5ef2cbe77a3cfacea7bcf4b714405388dc87bfeb..a9e3229b538dd5fe3281e2bbe0d7a87245bd400a 100644 (file)
@@ -39,9 +39,9 @@ int flush(librbd::ImageCtx *image_ctx) {
   return ctx.wait();
 }
 
-void scribble(librbd::ImageCtx *image_ctx, int num_ops, size_t max_size)
+void scribble(librbd::ImageCtx *image_ctx, int num_ops, uint64_t max_size)
 {
-  max_size = std::min(image_ctx->size, max_size);
+  max_size = std::min<uint64_t>(image_ctx->size, max_size);
   for (int i=0; i<num_ops; i++) {
     uint64_t off = rand() % (image_ctx->size - max_size + 1);
     uint64_t len = 1 + rand() % max_size;