From 1c26266dbf627e089e61d35507a48eb9b02d1596 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Mon, 21 Jul 2014 14:09:48 -0700 Subject: [PATCH] ObjectCacher: fix bh_{add,remove} dirty_or_tx_bh accounting tx buffers need to go on the bh_lru_rest as well, and removing erases (not inserts) them into dirty_or_tx_bh. Signed-off-by: Josh Durgin --- src/osdc/ObjectCacher.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index e87ec7a07ec08..ed18adc7e8548 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -2043,11 +2043,13 @@ void ObjectCacher::bh_add(Object *ob, BufferHead *bh) if (bh->is_dirty()) { bh_lru_dirty.lru_insert_top(bh); dirty_or_tx_bh.insert(bh); - } else if (bh->is_tx()) { - dirty_or_tx_bh.insert(bh); } else { bh_lru_rest.lru_insert_top(bh); } + + if (bh->is_tx()) { + dirty_or_tx_bh.insert(bh); + } bh_stat_add(bh); } @@ -2059,11 +2061,13 @@ void ObjectCacher::bh_remove(Object *ob, BufferHead *bh) if (bh->is_dirty()) { bh_lru_dirty.lru_remove(bh); dirty_or_tx_bh.erase(bh); - } else if (bh->is_tx()) { - dirty_or_tx_bh.insert(bh); } else { bh_lru_rest.lru_remove(bh); } + + if (bh->is_tx()) { + dirty_or_tx_bh.erase(bh); + } bh_stat_sub(bh); } -- 2.39.5