From: Kefu Chai Date: Fri, 15 Sep 2017 11:24:17 +0000 (+0800) Subject: osd: use list::remove_if() if possible X-Git-Tag: v13.0.1~857^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5e1c934118c3999936a0a7e7dd7d85995f5e197f;p=ceph.git osd: use list::remove_if() if possible Signed-off-by: Kefu Chai --- diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 2982656fdd34..5c26b7cb0281 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -935,16 +935,10 @@ public: } void clear_queued_recovery(PG *pg) { Mutex::Locker l(recovery_lock); - for (list >::iterator i = awaiting_throttle.begin(); - i != awaiting_throttle.end(); - ) { - if (i->second.get() == pg) { - awaiting_throttle.erase(i); - return; - } else { - ++i; - } - } + awaiting_throttle.remove_if( + [pg](decltype(awaiting_throttle)::const_reference awaiting ) { + return awaiting.second.get() == pg; + }); } // delayed pg activation void queue_for_recovery(PG *pg) {