]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: queue peering events directly, without pg lookup
authorSage Weil <sage@redhat.com>
Tue, 12 Dec 2017 15:29:15 +0000 (09:29 -0600)
committerSage Weil <sage@redhat.com>
Thu, 11 Jan 2018 23:07:00 +0000 (17:07 -0600)
We do not need to look up the PG in order to queue a peering event now
that the queue is based on spg_t and handles the validity checks (based on
the epoch) for us.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc

index 5ccdbf2030d217006103cc05ffe540536aa2b373..a903484efb0e73bd2de808bd23d6f84cad1d4d7a 100644 (file)
@@ -3824,7 +3824,7 @@ void OSD::add_newly_split_pg(PG *pg, PG::RecoveryCtx *rctx)
           to_wake->second.begin();
         i != to_wake->second.end();
         ++i) {
-      pg->queue_peering_event(*i);
+      enqueue_peering_evt(pg->get_pgid(), *i);
     }
     peering_wait_for_split.erase(to_wake);
   }
@@ -4077,20 +4077,13 @@ int OSD::handle_pg_peering_evt(
     dispatch_context(rctx, pg, osdmap);
 
     dout(10) << *pg << " is new" << dendl;
-
-    pg->queue_peering_event(evt);
+    enqueue_peering_evt(pg->get_pgid(), evt);
     wake_pg_waiters(pg);
     pg->unlock();
     return 0;
   } else {
-    // already had it.  did the mapping change?
-    if (epoch < pg->get_same_interval_since()) {
-      dout(10) << *pg << __func__ << " acting changed in "
-              << pg->get_same_interval_since()
-              << " (msg from " << epoch << ")" << dendl;
-    } else {
-      pg->queue_peering_event(evt);
-    }
+    // already had it
+    enqueue_peering_evt(pg->get_pgid(), evt);
     pg->unlock();
     return -EEXIST;
   }
@@ -8485,19 +8478,7 @@ void OSD::handle_pg_backfill_reserve(OpRequestRef op)
     ceph_abort();
   }
 
-  if (service.splitting(m->pgid)) {
-    peering_wait_for_split[m->pgid].push_back(evt);
-    return;
-  }
-
-  PG *pg = _lookup_lock_pg(m->pgid);
-  if (!pg) {
-    dout(10) << " don't have pg " << m->pgid << dendl;
-    return;
-  }
-
-  pg->queue_peering_event(evt);
-  pg->unlock();
+  enqueue_peering_evt(m->pgid, evt);
 }
 
 void OSD::handle_pg_recovery_reserve(OpRequestRef op)
@@ -8539,19 +8520,7 @@ void OSD::handle_pg_recovery_reserve(OpRequestRef op)
     ceph_abort();
   }
 
-  if (service.splitting(m->pgid)) {
-    peering_wait_for_split[m->pgid].push_back(evt);
-    return;
-  }
-
-  PG *pg = _lookup_lock_pg(m->pgid);
-  if (!pg) {
-    dout(10) << " don't have pg " << m->pgid << dendl;
-    return;
-  }
-
-  pg->queue_peering_event(evt);
-  pg->unlock();
+  enqueue_peering_evt(m->pgid, evt);
 }
 
 void OSD::handle_force_recovery(Message *m)
@@ -8716,17 +8685,12 @@ void OSD::handle_pg_remove(OpRequestRef op)
       continue;
     }
 
-    PG *pg = _lookup_lock_pg(pgid);
-    if (pg) {
-      pg->queue_peering_event(
-       PGPeeringEventRef(
-         new PGPeeringEvent(
-           m->get_epoch(), m->get_epoch(),
-           PG::DeleteStart())));
-      pg->unlock();
-    } else {
-      dout(10) << " don't have pg " << pgid << dendl;
-    }
+    enqueue_peering_evt(
+      pgid,
+      PGPeeringEventRef(
+       new PGPeeringEvent(
+         m->get_epoch(), m->get_epoch(),
+         PG::DeleteStart())));
   }
 }