Misc fixes for 32 bit architecture builds.
authorJames Page <james.page@ubuntu.com>
Fri, 14 Jan 2022 09:50:50 +0000 (09:50 +0000)
committerThomas Goirand <zigo@debian.org>
Fri, 14 Jan 2022 09:50:50 +0000 (09:50 +0000)
Forwarded: no

Gbp-Pq: Name 32bit-fixes.patch

src/SimpleRADOSStriper.cc
src/common/buffer.cc
src/librbd/object_map/DiffRequest.cc
src/os/bluestore/BlueFS.cc
src/s3select/include/s3select_functions.h
src/tools/cephfs_mirror/FSMirror.cc
src/tools/neorados.cc
src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc

index d6fe101f9e9e36f86790256d367225476498e6da..b85cf41718ba3381cdf7aefdbff9b89e199df3e8 100644 (file)
@@ -140,7 +140,7 @@ int SimpleRADOSStriper::remove()
   return 0;
 }
 
-int SimpleRADOSStriper::truncate(uint64_t size)
+int SimpleRADOSStriper::truncate(size_t size)
 {
   d(5) << size << dendl;
 
index 31154c96fc7a616a356e8a2fa631fbc843d8f3f3..9f6129b58678c4c9768eddbf1df6d1926eea1762 100644 (file)
@@ -2272,7 +2272,7 @@ MEMPOOL_DEFINE_OBJECT_FACTORY(buffer::raw_static, buffer_raw_static,
 
 void ceph::buffer::list::page_aligned_appender::_refill(size_t len) {
   const size_t alloc = \
-    std::max((size_t)min_alloc, (len + CEPH_PAGE_SIZE - 1) & CEPH_PAGE_MASK);
+    std::max((size_t)min_alloc, (size_t)((len + CEPH_PAGE_SIZE - 1) & CEPH_PAGE_MASK));
   auto new_back = \
     ptr_node::create(buffer::create_page_aligned(alloc));
   new_back->set_length(0);   // unused, so far.
index 566e98ac0f0fa2ccbe846e5a34ddf15895db1699..606d48bbf33c4d6eb9343a5b1735af47ee21cc8c 100644 (file)
@@ -175,7 +175,7 @@ void DiffRequest<I>::handle_load_object_map(int r) {
     m_object_map.resize(num_objs);
   }
 
-  size_t prev_object_diff_state_size = m_object_diff_state->size();
+  uint64_t prev_object_diff_state_size = m_object_diff_state->size();
   if (prev_object_diff_state_size < num_objs) {
     // the diff state should be the largest of all snapshots in the set
     m_object_diff_state->resize(num_objs);
index 37a000ac6ef6c96f24c46705137ef9b165ceff43..f48758e7a00984c65b7ee40c37f21fb366d03808 100644 (file)
@@ -3787,11 +3787,11 @@ int BlueFS::do_replay_recovery_read(FileReader *log_reader,
 
 size_t BlueFS::probe_alloc_avail(int dev, uint64_t alloc_size)
 {
-  size_t total = 0;
-  auto iterated_allocation = [&](size_t off, size_t len) {
+  uint64_t total = 0;
+  auto iterated_allocation = [&](uint64_t off, uint64_t len) {
     //only count in size that is alloc_size aligned
-    size_t dist_to_alignment;
-    size_t offset_in_block = off & (alloc_size - 1);
+    uint64_t dist_to_alignment;
+    uint64_t offset_in_block = off & (alloc_size - 1);
     if (offset_in_block == 0)
       dist_to_alignment = 0;
     else
index 77b3db3a7771af7cac5227d089df2553042125c7..9abc72a6e11759396dc3321c4e560de961468982 100644 (file)
@@ -585,7 +585,7 @@ struct _fn_diff_timestamp : public base_function
     {
       boost::gregorian::date_period dp =
         boost::gregorian::date_period( val_dt1.timestamp()->date(), val_dt2.timestamp()->date());
-      result->set_value( dp.length().days() );
+      result->set_value( (int64_t)dp.length().days() );
     }
     else if (strcmp(val_date_part.str(), "hours") == 0)
     {
index 76dcc11f6c6b71364e6b333fbe80d79bfe33a931..9e9cfe72762215b93abaef18d22e5e50ffcf64b4 100644 (file)
@@ -345,7 +345,7 @@ void FSMirror::handle_acquire_directory(string_view dir_path) {
     std::scoped_lock locker(m_lock);
     m_directories.emplace(dir_path);
     m_service_daemon->add_or_update_fs_attribute(m_filesystem.fscid, SERVICE_DAEMON_DIR_COUNT_KEY,
-                                                 m_directories.size());
+                                                 static_cast<uint64_t>(m_directories.size()));
 
     for (auto &[peer, peer_replayer] : m_peer_replayers) {
       dout(10) << ": peer=" << peer << dendl;
@@ -363,7 +363,7 @@ void FSMirror::handle_release_directory(string_view dir_path) {
     if (it != m_directories.end()) {
       m_directories.erase(it);
       m_service_daemon->add_or_update_fs_attribute(m_filesystem.fscid, SERVICE_DAEMON_DIR_COUNT_KEY,
-                                                   m_directories.size());
+                                                   static_cast<uint64_t>(m_directories.size()));
       for (auto &[peer, peer_replayer] : m_peer_replayers) {
         dout(10) << ": peer=" << peer << dendl;
         peer_replayer->remove_directory(dir_path);
index 516dfbce7fe6e9cc77c22ba482f317866c2a6fad..822335d513fd1317b0afc5db5e8c87c95619b46f 100644 (file)
@@ -146,7 +146,7 @@ void create(R::RADOS& r, const std::vector<std::string>& p,
                             obj, pname));
 }
 
-inline constexpr std::size_t io_size = 4 << 20;
+inline constexpr std::uint64_t io_size = 4 << 20;
 
 void write(R::RADOS& r, const std::vector<std::string>& p, s::yield_context y)
 {
@@ -156,7 +156,7 @@ void write(R::RADOS& r, const std::vector<std::string>& p, s::yield_context y)
 
   bs::error_code ec;
   std::unique_ptr<char[]> buf = std::make_unique<char[]>(io_size);
-  std::size_t off = 0;
+  std::uint64_t off = 0;
   boost::io::ios_exception_saver ies(std::cin);
 
   std::cin.exceptions(std::istream::badbit);
@@ -203,7 +203,7 @@ void read(R::RADOS& r, const std::vector<std::string>& p, s::yield_context y)
                    obj, pname));
   }
 
-  std::size_t off = 0;
+  std::uint64_t off = 0;
   ceph::buffer::list bl;
   while (auto toread = std::max(len - off, io_size)) {
     R::ReadOp op;
index e94ec71dfe2d3275f2b7300a60c7170325bc6a30..ae7581c8bf3f134ba50f4c5a099af8bed21ec1de 100644 (file)
@@ -253,7 +253,8 @@ bool Replayer<I>::get_replay_status(std::string* description,
 
   json_spirit::mObject root_obj;
   root_obj["replay_state"] = replay_state;
-  root_obj["remote_snapshot_timestamp"] = remote_snap_info->timestamp.sec();
+  root_obj["remote_snapshot_timestamp"] = static_cast<uint64_t>(
+    remote_snap_info->timestamp.sec());
 
   auto matching_remote_snap_id = util::compute_remote_snap_id(
     m_state_builder->local_image_ctx->image_lock,
@@ -267,8 +268,8 @@ bool Replayer<I>::get_replay_status(std::string* description,
     // use the timestamp from the matching remote image since
     // the local snapshot would just be the time the snapshot was
     // synced and not the consistency point in time.
-    root_obj["local_snapshot_timestamp"] =
-      matching_remote_snap_it->second.timestamp.sec();
+    root_obj["local_snapshot_timestamp"] = static_cast<uint64_t>(
+      matching_remote_snap_it->second.timestamp.sec());
   }
 
   matching_remote_snap_it = m_state_builder->remote_image_ctx->snap_info.find(
@@ -276,7 +277,8 @@ bool Replayer<I>::get_replay_status(std::string* description,
   if (m_remote_snap_id_end != CEPH_NOSNAP &&
       matching_remote_snap_it !=
         m_state_builder->remote_image_ctx->snap_info.end()) {
-    root_obj["syncing_snapshot_timestamp"] = remote_snap_info->timestamp.sec();
+    root_obj["syncing_snapshot_timestamp"] = static_cast<uint64_t>(
+        remote_snap_info->timestamp.sec());
     root_obj["syncing_percent"] = static_cast<uint64_t>(
         100 * m_local_mirror_snap_ns.last_copied_object_number /
         static_cast<float>(std::max<uint64_t>(1U, m_local_object_count)));