]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: requeue snap_trimmer after scrub finishes
authorMike Ryan <mike.ryan@inktank.com>
Wed, 31 Oct 2012 18:36:49 +0000 (11:36 -0700)
committerMike Ryan <mike.ryan@inktank.com>
Wed, 31 Oct 2012 22:42:03 +0000 (15:42 -0700)
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>
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc

index 1e66d93b303133cf8dfe1edc806af04f306ed34a..ec9a495074b374f2d858bb4e1a350b4467f98c4a 100644 (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
index cf0173352da894299e4808a65258025bb2da984e..15a00610731476514637833fce039b6450e6998d 100644 (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) {
index d23a8bc2a53a362ae80458807a47ccaee33daf77..336cb91697144652cc11c7286ecf87ef6269fa76 100644 (file)
@@ -1463,9 +1463,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;
     }