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 <mike.ryan@inktank.com>
This commit is contained in:
Mike Ryan 2012-10-31 11:36:49 -07:00
parent 310796a9dd
commit 1bb65373df
3 changed files with 13 additions and 5 deletions

View File

@ -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

View File

@ -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<int> 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) {

View File

@ -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;
}