From 45ab728cd895c83f1fbc2679135af4eeb9c6610e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 24 Oct 2015 18:01:06 -0400 Subject: [PATCH] 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 --- src/osd/OSD.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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 -- 2.47.3