From: Sage Weil Date: Fri, 10 Jun 2016 12:51:47 +0000 (-0400) Subject: os/bluestore: cache: control insert point of new onodes X-Git-Tag: v11.0.0~70^2~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=94648e2bd5bb7f77cbb486275129520edd49fe09;p=ceph-ci.git os/bluestore: cache: control insert point of new onodes Not used yet. Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ec04890f048..d439019cc4c 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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)); diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 2b17a1e48b6..df56d91d9e8 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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);