]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ObjectCacher: fix bh_{add,remove} dirty_or_tx_bh accounting
authorJosh Durgin <josh.durgin@inktank.com>
Mon, 21 Jul 2014 21:09:48 +0000 (14:09 -0700)
committerHaomai Wang <haomaiwang@gmail.com>
Sun, 27 Jul 2014 05:36:28 +0000 (13:36 +0800)
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 <josh.durgin@inktank.com>
src/osdc/ObjectCacher.cc

index e87ec7a07ec088d18c1e45fcaad76db5ddc802f2..ed18adc7e85484aa280137569a3e08d1622b98d9 100644 (file)
@@ -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);
 }