From: Kefu Chai Date: Tue, 6 Apr 2021 07:18:42 +0000 (+0800) Subject: common/buffer.cc: use shift_round_up() when appropriate X-Git-Tag: v17.1.0~2343^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F40609%2Fhead;p=ceph.git common/buffer.cc: use shift_round_up() when appropriate Signed-off-by: Kefu Chai --- diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 6622b395afdb..895d4dc2f170 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(min_alloc), static_cast((len + CEPH_PAGE_SIZE - 1) & CEPH_PAGE_MASK)); + const unsigned alloc = + std::max(min_alloc, + shift_round_up(static_cast(len), + static_cast(CEPH_PAGE_SHIFT))); auto new_back = \ ptr_node::create(buffer::create_page_aligned(alloc)); new_back->set_length(0); // unused, so far.