From fda7a08106b14c804a60483f245c31138e7998a1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 10 Jun 2016 11:23:27 -0400 Subject: [PATCH] os/bluestore: cache: simplify lru trim Everything in the LRU is clean. Signed-off-by: Sage Weil --- src/os/bluestore/BlueStore.cc | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 08b7dffb22e0f..e6a2bc0505720 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -482,19 +482,13 @@ void BlueStore::LRUCache::trim(uint64_t onode_max, uint64_t buffer_max) } while (buffer_size > buffer_max) { Buffer *b = &*i; - if (b->is_clean()) { - auto p = b->space->buffer_map.find(b->offset); - if (i != buffer_lru.begin()) { - --i; - } - dout(20) << __func__ << " rm " << *b << dendl; - b->space->_rm_buffer(p); - } if (i != buffer_lru.begin()) { + assert(b->is_clean()); + auto p = b->space->buffer_map.find(b->offset); + if (i != buffer_lru.begin()) { --i; - continue; - } else { - break; } + dout(20) << __func__ << " rm " << *b << dendl; + b->space->_rm_buffer(p); } // onodes -- 2.39.5