]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: no bother to create RecoveryCtx if no recovery op is started 5415/head
authorZhiqiang Wang <zhiqiang.wang@intel.com>
Wed, 29 Jul 2015 08:20:00 +0000 (16:20 +0800)
committerZhiqiang Wang <zhiqiang.wang@intel.com>
Tue, 25 Aug 2015 08:10:23 +0000 (16:10 +0800)
If there is no recovery op started, there is no need to create a RecoveryCtx
and later delete all of the things in it.

Signed-off-by: Zhiqiang Wang <zhiqiang.wang@intel.com>
src/osd/OSD.cc

index b9f307c4cadc4466d700906673dcdc3783fab770..0c092a60ac0141f08ae11cfe95dcd3b43fe8bdef 100644 (file)
@@ -7839,12 +7839,17 @@ void OSD::do_recovery(PG *pg, ThreadPool::TPHandle &handle)
     dout(20) << "  active was " << recovery_oids[pg->info.pgid] << dendl;
 #endif
     
-    PG::RecoveryCtx rctx = create_context();
-    rctx.handle = &handle;
-
     int started;
     bool more = pg->start_recovery_ops(max, handle, &started);
     dout(10) << "do_recovery started " << started << "/" << max << " on " << *pg << dendl;
+    // If no recovery op is started, don't bother to manipulate the RecoveryCtx
+    if (!started && (more || !pg->have_unfound())) {
+      pg->unlock();
+      goto out;
+    }
+
+    PG::RecoveryCtx rctx = create_context();
+    rctx.handle = &handle;
 
     /*
      * if we couldn't start any recovery ops and things are still