From 852aab64f6e89f8c53dd001a4049a861591f1117 Mon Sep 17 00:00:00 2001 From: Ning Yao Date: Fri, 26 Dec 2014 04:20:35 +0000 Subject: [PATCH] PG:: filter_snapc: Return immediately if no snapc need to trim we can return immediately if no snapc need to trim. Do not iterater snapc vector and do extra judgement and ops. Signed-off-by: Ning Yao --- src/osd/PG.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 49b7c9d4f580..20d71548c0bf 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2999,6 +2999,10 @@ void PG::update_snap_map( */ void PG::filter_snapc(vector &snaps) { + //nothing needs to trim, we can return immediately + if(snap_trimq.empty() && info.purged_snaps.empty()) + return; + bool filtering = false; vector newsnaps; for (vector::iterator p = snaps.begin(); -- 2.47.3