onode_map.clear();
}
-void BlueStore::OnodeHashLRU::rename(const ghobject_t& old_oid,
- const ghobject_t& new_oid)
+void BlueStore::OnodeHashLRU::rename(OnodeRef& oldo,
+ const ghobject_t& old_oid,
+ const ghobject_t& new_oid)
{
std::lock_guard<std::mutex> l(lock);
dout(30) << __func__ << " " << old_oid << " -> " << new_oid << dendl;
OnodeRef o = po->second;
// install a non-existent onode at old location
- po->second.reset(new Onode(old_oid, o->key));
+ oldo.reset(new Onode(old_oid, o->key));
+ po->second = oldo;
lru.push_back(*po->second);
// add at new position and fix oid, key
txc->t->rmkey(PREFIX_OBJ, oldo->key);
txc->write_onode(oldo);
newo = oldo;
- oldo.reset(NULL);
- c->onode_map.rename(old_oid, new_oid); // this adjusts oldo->{oid,key}
+
+ // this adjusts oldo->{oid,key}, and reset oldo to a fresh empty
+ // Onode in the old slot
+ c->onode_map.rename(oldo, old_oid, new_oid);
r = 0;
out:
void add(const ghobject_t& oid, OnodeRef o);
void _touch(OnodeRef o);
OnodeRef lookup(const ghobject_t& o);
- void rename(const ghobject_t& old_oid, const ghobject_t& new_oid);
+ void rename(OnodeRef& o, const ghobject_t& old_oid, const ghobject_t& new_oid);
void clear();
bool get_next(const ghobject_t& after, pair<ghobject_t,OnodeRef> *next);
int trim(int max=-1);