aboutsummaryrefslogtreecommitdiffstats
path: root/community/ceph/32-upstream32bit.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/ceph/32-upstream32bit.patch')
-rw-r--r--community/ceph/32-upstream32bit.patch92
1 files changed, 92 insertions, 0 deletions
diff --git a/community/ceph/32-upstream32bit.patch b/community/ceph/32-upstream32bit.patch
new file mode 100644
index 0000000000..917cd036bc
--- /dev/null
+++ b/community/ceph/32-upstream32bit.patch
@@ -0,0 +1,92 @@
+commit 72a5993da70955182a73755ddba35005a6d9fc11
+Author: Kefu Chai <kchai@redhat.com>
+Date: Tue Apr 27 18:24:24 2021 +0800
+
+ cls/rbd, librbd: use uint64_t for sparse_size
+
+ the size of `size_t` is varies from architecture to architecture. the
+ C++ standard only requires it to be able to represent the maximum possible
+ size of object of any type. on 32-bit architectures, it's very likely a
+ 32-bit unsigned integer. to ensure the interoperability between the
+ 64-bit systems and 32-bit systems, we should use a type with explicitly
+ defined size.
+
+ also, we don't define the dencoder for size_t. so on systems where
+ size_t is not backed by uint32_t or uint64_t, the tree does not compile.
+
+ in this change, use uint64_t for sparse_size. and leave
+ `C_SparsifyObject::m_sparse_size` intact. as the latter should be able
+ to be promoted to uint64_t when necessary.
+
+ this change is backward compatible on 64-bit systems.
+
+ Signed-off-by: Kefu Chai <kchai@redhat.com>
+
+diff --git a/src/cls/rbd/cls_rbd.cc b/src/cls/rbd/cls_rbd.cc
+index 33910b7df5..e3e05d85ed 100644
+--- a/src/cls/rbd/cls_rbd.cc
++++ b/src/cls/rbd/cls_rbd.cc
+@@ -7996,7 +7996,7 @@ int namespace_list(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
+ */
+ int sparsify(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
+ {
+- size_t sparse_size;
++ uint64_t sparse_size;
+ bool remove_empty;
+ try {
+ auto iter = in->cbegin();
+diff --git a/src/cls/rbd/cls_rbd_client.cc b/src/cls/rbd/cls_rbd_client.cc
+index cefa1fed79..fee3ac8923 100644
+--- a/src/cls/rbd/cls_rbd_client.cc
++++ b/src/cls/rbd/cls_rbd_client.cc
+@@ -2974,7 +2974,7 @@ int namespace_list(librados::IoCtx *ioctx,
+ return namespace_list_finish(&iter, entries);
+ }
+
+-void sparsify(librados::ObjectWriteOperation *op, size_t sparse_size,
++void sparsify(librados::ObjectWriteOperation *op, uint64_t sparse_size,
+ bool remove_empty)
+ {
+ bufferlist bl;
+@@ -2983,7 +2983,7 @@ void sparsify(librados::ObjectWriteOperation *op, size_t sparse_size,
+ op->exec("rbd", "sparsify", bl);
+ }
+
+-int sparsify(librados::IoCtx *ioctx, const std::string &oid, size_t sparse_size,
++int sparsify(librados::IoCtx *ioctx, const std::string &oid, uint64_t sparse_size,
+ bool remove_empty)
+ {
+ librados::ObjectWriteOperation op;
+diff --git a/src/cls/rbd/cls_rbd_client.h b/src/cls/rbd/cls_rbd_client.h
+index 12b34c4832..ef2b05fd84 100644
+--- a/src/cls/rbd/cls_rbd_client.h
++++ b/src/cls/rbd/cls_rbd_client.h
+@@ -652,9 +652,9 @@ int sparse_copyup(librados::IoCtx *ioctx, const std::string &oid,
+ const std::map<uint64_t, uint64_t> &extent_map,
+ ceph::buffer::list data);
+
+-void sparsify(librados::ObjectWriteOperation *op, size_t sparse_size,
++void sparsify(librados::ObjectWriteOperation *op, uint64_t sparse_size,
+ bool remove_empty);
+-int sparsify(librados::IoCtx *ioctx, const std::string &oid, size_t sparse_size,
++int sparsify(librados::IoCtx *ioctx, const std::string &oid, uint64_t sparse_size,
+ bool remove_empty);
+
+ } // namespace cls_client
+diff --git a/src/librbd/WatchNotifyTypes.h b/src/librbd/WatchNotifyTypes.h
+index ca0b40f28f..4fad31ffac 100644
+--- a/src/librbd/WatchNotifyTypes.h
++++ b/src/librbd/WatchNotifyTypes.h
+@@ -410,10 +410,10 @@ struct MigratePayload : public AsyncRequestPayloadBase {
+ };
+
+ struct SparsifyPayload : public AsyncRequestPayloadBase {
+- size_t sparse_size = 0;
++ uint64_t sparse_size = 0;
+
+ SparsifyPayload() {}
+- SparsifyPayload(const AsyncRequestId &id, size_t sparse_size)
++ SparsifyPayload(const AsyncRequestId &id, uint64_t sparse_size)
+ : AsyncRequestPayloadBase(id), sparse_size(sparse_size) {
+ }
+