From: Sage Weil Date: Sat, 24 Oct 2015 22:01:06 +0000 (-0400) Subject: osd: only calculate op crush mapping if we don't have the PG X-Git-Tag: v10.0.1~62^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=45ab728cd895c83f1fbc2679135af4eeb9c6610e;p=ceph.git osd: only calculate op crush mapping if we don't have the PG We were pessimistically calculating the request mapping to ensure that it is really meant for us before looking up the PG. Instead, look up the PG, and queue it there if we have it--the PG already does the necessary checks in PG::can_discard_op(). If we don't have the PG, *then* do the crush mapping and extra checks. Reported-by: Somnath Roy Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a8c9588c45bc..f242898c1741 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -8123,6 +8123,17 @@ void OSD::handle_op(OpRequestRef& op, OSDMapRef& osdmap) return; } + PG *pg = get_pg_or_queue_for_pg(pgid, op); + if (pg) { + op->send_map_update = share_map.should_send; + op->sent_epoch = m->get_map_epoch(); + enqueue_op(pg, op); + share_map.should_send = false; + return; + } + + // ok, we didn't have the PG. let's see if it's our fault or the client's. + OSDMapRef send_map = service.try_get_map(m->get_map_epoch()); // check send epoch if (!send_map) { @@ -8162,14 +8173,6 @@ void OSD::handle_op(OpRequestRef& op, OSDMapRef& osdmap) << dendl; return; } - - PG *pg = get_pg_or_queue_for_pg(pgid, op); - if (pg) { - op->send_map_update = share_map.should_send; - op->sent_epoch = m->get_map_epoch(); - enqueue_op(pg, op); - share_map.should_send = false; - } } template