From 27e546a32fbb2b20c1cc820e53ba64a061c6f64c Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 10 May 2017 19:01:49 +0800 Subject: [PATCH] os/bluestore: pre-calculate number of ghost buffers to evict Signed-off-by: xie xingguo --- src/os/bluestore/BlueStore.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ee8a5042d5390..8197cbad759f8 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1134,7 +1134,8 @@ void BlueStore::TwoQCache::_trim(uint64_t onode_max, uint64_t buffer_max) } // adjust warm out list too, if necessary - while (buffer_warm_out.size() > kout) { + int64_t num = buffer_warm_out.size() - kout; + while (num-- > 0) { Buffer *b = &*buffer_warm_out.rbegin(); assert(b->is_empty()); dout(20) << __func__ << " buffer_warm_out rm " << *b << dendl; -- 2.39.5