From bcc9715deb9a1128b7daeaefbfe0ad82844f31a9 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Wed, 28 Mar 2018 15:55:48 +0300 Subject: [PATCH] os/bluestore: fix broken cap in _balance_bluefs_freespace() 1 << 31 is cast to signed int that results in huge value when casting to uint64_t making min() call ineffective. Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueStore.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index a59c02bb7eb4..fbd84137211e 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5129,7 +5129,7 @@ int BlueStore::_balance_bluefs_freespace(PExtentVector *extents) gift = p2roundup(gift, cct->_conf->bluefs_alloc_size); // hard cap to fit into 32 bits - gift = std::min(gift, 1 << 31); + gift = std::min(gift, 1ull << 31); dout(10) << __func__ << " gifting " << gift << " (" << pretty_si_t(gift) << ")" << dendl; @@ -5166,7 +5166,7 @@ int BlueStore::_balance_bluefs_freespace(PExtentVector *extents) reclaim = p2roundup(reclaim, cct->_conf->bluefs_alloc_size); // hard cap to fit into 32 bits - reclaim = std::min(reclaim, 1 << 31); + reclaim = std::min(reclaim, 1ull << 31); dout(10) << __func__ << " reclaiming " << reclaim << " (" << pretty_si_t(reclaim) << ")" << dendl; -- 2.47.3