]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: cache: control insert point of new onodes
authorSage Weil <sage@redhat.com>
Fri, 10 Jun 2016 12:51:47 +0000 (08:51 -0400)
committerSage Weil <sage@redhat.com>
Wed, 22 Jun 2016 15:28:40 +0000 (11:28 -0400)
Not used yet.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index ec04890f048a7c77cb623c491802d54252e39ccb..d439019cc4c637b85034360d8cceae1760062e63 100644 (file)
@@ -735,7 +735,7 @@ void BlueStore::OnodeSpace::add(const ghobject_t& oid, OnodeRef o)
   dout(30) << __func__ << " " << oid << " " << o << dendl;
   assert(onode_map.count(oid) == 0);
   onode_map[oid] = o;
-  cache->_add_onode(o);
+  cache->_add_onode(o, 1);
 }
 
 BlueStore::OnodeRef BlueStore::OnodeSpace::lookup(const ghobject_t& oid)
@@ -787,7 +787,7 @@ void BlueStore::OnodeSpace::rename(OnodeRef& oldo,
   // install a non-existent onode at old location
   oldo.reset(new Onode(this, old_oid, o->key));
   po->second = oldo;
-  cache->_add_onode(po->second);
+  cache->_add_onode(po->second, 1);
 
   // add at new position and fix oid, key
   onode_map.insert(make_pair(new_oid, o));
index 2b17a1e48b6c70f202069092ae6cd4a9d18fe105..df56d91d9e8725edddac37bcfc5f7582a77b4032 100644 (file)
@@ -513,11 +513,13 @@ public:
     uint64_t buffer_size = 0;
 
   public:
-
     std::mutex lock;                ///< protect lru and other structures
 
-    void _add_onode(OnodeRef& o) {
-        onode_lru.push_front(*o);
+    void _add_onode(OnodeRef& o, int level) {
+      if (level > 0)
+       onode_lru.push_front(*o);
+      else
+       onode_lru.push_back(*o);
     }
     void _rm_onode(OnodeRef& o) {
       auto q = onode_lru.iterator_to(*o);