aboutsummaryrefslogtreecommitdiffstats
path: root/community/ceph/32-upstream32bit.patch
blob: 917cd036bc06e8552f9a96776e5485298b7920a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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) {
   }