]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: replace object_contexts.find with object_contexts.lookup
authorLoic Dachary <loic@dachary.org>
Tue, 13 Aug 2013 15:02:40 +0000 (17:02 +0200)
committerLoic Dachary <loic@dachary.org>
Thu, 22 Aug 2013 00:10:59 +0000 (02:10 +0200)
The std::map equivalent of find is SharedPtrRegistry::lookup

http://tracker.ceph.com/issues/5510 refs #5510

Signed-off-by: Loic Dachary <loic@dachary.org>
src/osd/ReplicatedPG.cc

index a1bba507033a4633e1dcf5cdee14208af3d22984..0998416dbb2783a07b53e28ec9b6dde9e4d5afd4 100644 (file)
@@ -4500,12 +4500,9 @@ ObjectContextRef ReplicatedPG::create_object_context(const object_info_t& oi,
 ObjectContextRef ReplicatedPG::get_object_context(const hobject_t& soid,
                                                  bool can_create)
 {
-  map<hobject_t, ObjectContext*>::iterator p = object_contexts.find(soid);
-  ObjectContext *obc;
-  if (p != object_contexts.end()) {
-    obc = p->second;
-    dout(10) << "get_object_context " << obc << " " << soid << " " << obc->ref
-            << " -> " << (obc->ref+1) << dendl;
+  ObjectContextRef obc = object_contexts.lookup(soid);
+  if (obc) {
+    dout(10) << "get_object_context " << obc << " " << soid << dendl;
   } else {
     // check disk
     bufferlist bv;
@@ -6076,12 +6073,11 @@ bool ReplicatedPG::handle_push_reply(int peer, PushReplyOp &op, PushOp *reply)
 void ReplicatedPG::finish_degraded_object(const hobject_t& oid)
 {
   dout(10) << "finish_degraded_object " << oid << dendl;
-  map<hobject_t, ObjectContext *>::iterator i = object_contexts.find(oid);
-  if (i != object_contexts.end()) {
-    i->second->get();
-    for (set<ObjectContext*>::iterator j = i->second->blocking.begin();
-        j != i->second->blocking.end();
-        i->second->blocking.erase(j++)) {
+  ObjectContextRef obc(object_contexts.lookup(oid));
+  if (obc) {
+    for (set<ObjectContextRef>::iterator j = obc->blocking.begin();
+        j != obc->blocking.end();
+        obc->blocking.erase(j++)) {
       dout(10) << " no longer blocking writes for " << (*j)->obs.oi.soid << dendl;
       (*j)->blocked_by = ObjectContextRef();
     }