diff options
author | Kefu Chai <kchai@redhat.com> | 2021-04-06 09:18:42 +0200 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2021-04-06 10:08:25 +0200 |
commit | c0f722568709ded9c81bee5e149cdf70ac29cdb4 (patch) | |
tree | a1d9ee19010e687d999f9a8cce248a49554d57c4 /src/common/buffer.cc | |
parent | Merge pull request #40582 from a16bitsysop/32bit (diff) | |
download | ceph-c0f722568709ded9c81bee5e149cdf70ac29cdb4.tar.xz ceph-c0f722568709ded9c81bee5e149cdf70ac29cdb4.zip |
common/buffer.cc: use shift_round_up() when appropriate
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/common/buffer.cc')
-rw-r--r-- | src/common/buffer.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 6622b395afd..895d4dc2f17 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -34,6 +34,7 @@ #include "common/valgrind.h" #include "common/deleter.h" #include "common/error_code.h" +#include "include/intarith.h" #include "include/spinlock.h" #include "include/scope_guard.h" @@ -2276,8 +2277,10 @@ 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(static_cast<size_t>(min_alloc), static_cast<size_t>((len + CEPH_PAGE_SIZE - 1) & CEPH_PAGE_MASK)); + const unsigned alloc = + std::max(min_alloc, + shift_round_up(static_cast<unsigned>(len), + static_cast<unsigned>(CEPH_PAGE_SHIFT))); auto new_back = \ ptr_node::create(buffer::create_page_aligned(alloc)); new_back->set_length(0); // unused, so far. |