]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
cls/rbd, librbd: use uint64_t for sparse_size
authorKefu Chai <kchai@redhat.com>
Tue, 27 Apr 2021 10:24:24 +0000 (18:24 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 27 Apr 2021 11:08:00 +0000 (19:08 +0800)
commit72a5993da70955182a73755ddba35005a6d9fc11
treeb78d2a842434abcb87024aaf3c71141ca98e810d
parentf0e1a16898077280deeea9f65310c8bb1a65b460
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>
src/cls/rbd/cls_rbd.cc
src/cls/rbd/cls_rbd_client.cc
src/cls/rbd/cls_rbd_client.h
src/librbd/WatchNotifyTypes.h