]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: check for primary out side of is_misdirected()
authorKefu Chai <kchai@redhat.com>
Sun, 30 Aug 2020 15:09:14 +0000 (23:09 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 30 Aug 2020 15:15:25 +0000 (23:15 +0800)
so we can check can_serve_replica_read() without checking primary again.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/osd_operations/client_request.cc

index 2b6f6e742b4f3ac1682e5196fe93a1cd037c8b41..0ead1626873a925e247a596eb68e17ccaa353b03 100644 (file)
@@ -137,7 +137,9 @@ seastar::future<> ClientRequest::process_op(
     return with_blocking_future(handle.enter(pp(pg).get_obc));
   }).then([this, &pg]() -> PG::load_obc_ertr::future<> {
     op_info.set_from_op(&*m, *pg.get_osdmap());
-    if (is_misdirected(pg)) {
+    if (pg.is_primary()) {
+      // primary can handle both normal ops and balanced reads
+    } else if (is_misdirected(pg)) {
       logger().trace("process_op: dropping misdirected op");
       return seastar::now();
     }
@@ -163,10 +165,6 @@ seastar::future<> ClientRequest::process_op(
 
 bool ClientRequest::is_misdirected(const PG& pg) const
 {
-  // primary can handle both normal ops and balanced reads
-  if (pg.is_primary()) {
-    return false;
-  }
   // otherwise take a closer look
   if (const int flags = m->get_flags();
       flags & CEPH_OSD_FLAG_BALANCE_READS ||