From 1bb65373dfbb3ad1a4d76c5b58cfb855608648f8 Mon Sep 17 00:00:00 2001 From: Mike Ryan Date: Wed, 31 Oct 2012 11:36:49 -0700 Subject: [PATCH] PG: requeue snap_trimmer after scrub finishes Previously the snap_trimmer would continuously requeue itself until the end of scrub. This degrades performance and fills up logs for No Good Reason. Signed-off-by: Mike Ryan --- src/osd/PG.cc | 5 +++++ src/osd/PG.h | 6 ++++-- src/osd/ReplicatedPG.cc | 7 ++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 1e66d93b303..ec9a495074b 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3743,6 +3743,11 @@ void PG::scrub_clear_state() requeue_ops(waiting_for_active); + if (scrubber.queue_snap_trim) { + dout(10) << "scrub finished, requeuing snap_trimmer" << dendl; + queue_snap_trim(); + } + scrubber.reset(); // type-specific state clear diff --git a/src/osd/PG.h b/src/osd/PG.h index cf0173352da..15a00610731 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -791,8 +791,8 @@ public: Scrubber() : reserved(false), reserve_failed(false), epoch_start(0), - block_writes(false), active(false), waiting_on(0), - errors(0), fixed(0), active_rep_scrub(0), + block_writes(false), active(false), queue_snap_trim(false), + waiting_on(0), errors(0), fixed(0), active_rep_scrub(0), finalizing(false), is_chunky(false), state(INACTIVE), deep(false) { @@ -806,6 +806,7 @@ public: // common to both scrubs bool block_writes; bool active; + bool queue_snap_trim; int waiting_on; set waiting_on_whom; int errors; @@ -860,6 +861,7 @@ public: finalizing = false; block_writes = false; active = false; + queue_snap_trim = false; waiting_on = 0; waiting_on_whom.clear(); if (active_rep_scrub) { diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 5763c43d985..c7225f5aa90 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1468,9 +1468,10 @@ void ReplicatedPG::snap_trimmer() dout(10) << "snap_trimmer entry" << dendl; if (is_primary()) { entity_inst_t nobody; - if (!mode.try_write(nobody) || scrubber.active) { - dout(10) << " can't write, requeueing" << dendl; - queue_snap_trim(); + assert(mode.try_write(nobody)); + if (scrubber.active) { + dout(10) << " scrubbing, will requeue snap_trimmer after" << dendl; + scrubber.queue_snap_trim = true; unlock(); return; }