From: Zhiqiang Wang Date: Wed, 29 Jul 2015 08:20:00 +0000 (+0800) Subject: osd: no bother to create RecoveryCtx if no recovery op is started X-Git-Tag: v9.1.0~281^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8c2f8bf54b90337421b99a1bc100e2ae896ddd99;p=ceph.git osd: no bother to create RecoveryCtx if no recovery op is started 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index b9f307c4cadc..0c092a60ac01 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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