From 173116faac50e7c5e596ddcf323b8edbe87bfaa2 Mon Sep 17 00:00:00 2001 From: Guang Yang Date: Thu, 6 Mar 2014 11:15:48 -0800 Subject: [PATCH] osd: only register for scrub if we are the PG primary There is no reason to put non-primary PGs on the scrub schedule as they will be ignored when the worker comes around. This reduces lock contention and is generally cleaner. Signed-off-by: Guang Yang Signed-off-by: Sage Weil --- src/osd/PG.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 3537ce576acc..34a23bd0d4b2 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3017,12 +3017,14 @@ void PG::reg_next_scrub() } else { scrubber.scrub_reg_stamp = info.history.last_scrub_stamp; } - osd->reg_last_pg_scrub(info.pgid, scrubber.scrub_reg_stamp); + if (is_primary()) + osd->reg_last_pg_scrub(info.pgid, scrubber.scrub_reg_stamp); } void PG::unreg_next_scrub() { - osd->unreg_last_pg_scrub(info.pgid, scrubber.scrub_reg_stamp); + if (is_primary()) + osd->unreg_last_pg_scrub(info.pgid, scrubber.scrub_reg_stamp); } void PG::sub_op_scrub_map(OpRequestRef op) -- 2.47.3