]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: scrub interval checking
authorDavid Zafman <david.zafman@inktank.com>
Tue, 14 May 2013 07:57:05 +0000 (00:57 -0700)
committerDavid Zafman <david.zafman@inktank.com>
Tue, 14 May 2013 23:28:45 +0000 (16:28 -0700)
Do arithmetic so large intervals don't wrap
Fix log messages to reflect the change and improve output
Add message when skipping scrub due to load

fixes: #5049

Signed-off-by: David Zafman <david.zafman@inktank.com>
src/osd/OSD.cc

index b8ef3bb2098c7ef3113042295ba54e148a4ccebf..299d8db64b4324a9903ad000ff3fe8191373caaa 100644 (file)
@@ -4041,10 +4041,7 @@ void OSD::sched_scrub()
 
   dout(20) << "sched_scrub load_is_low=" << (int)load_is_low << dendl;
 
-  utime_t max = ceph_clock_now(g_ceph_context);
-  utime_t min = max;
-  min -= g_conf->osd_scrub_min_interval;
-  max -= g_conf->osd_scrub_max_interval;
+  utime_t now = ceph_clock_now(g_ceph_context);
   
   //dout(20) << " " << last_scrub_pg << dendl;
 
@@ -4053,15 +4050,18 @@ void OSD::sched_scrub()
     do {
       utime_t t = pos.first;
       pg_t pgid = pos.second;
-      dout(30) << " " << pgid << " at " << t << dendl;
+      dout(30) << "sched_scrub examine " << pgid << " at " << t << dendl;
 
-      if (t > min) {
-       dout(10) << " " << pgid << " at " << t
-                << " > min " << min << " (" << g_conf->osd_scrub_min_interval << " seconds ago)" << dendl;
+      utime_t diff = now - t;
+      if ((double)diff < g_conf->osd_scrub_min_interval) {
+       dout(10) << "sched_scrub " << pgid << " at " << t
+                << ": " << (double)diff << " < min (" << g_conf->osd_scrub_min_interval << " seconds)" << dendl;
        break;
       }
-      if (t > max && !load_is_low) {
+      if ((double)diff < g_conf->osd_scrub_max_interval && !load_is_low) {
        // save ourselves some effort
+       dout(10) << "sched_scrub " << pgid << " high load at " << t
+                << ": " << (double)diff << " < max (" << g_conf->osd_scrub_max_interval << " seconds)" << dendl;
        break;
       }
 
@@ -4069,11 +4069,11 @@ void OSD::sched_scrub()
       if (pg) {
        if (pg->is_active() &&
            (load_is_low ||
-            t < max ||
+            (double)diff >= g_conf->osd_scrub_max_interval ||
             pg->scrubber.must_scrub)) {
-         dout(10) << " " << pgid << " at " << t
-                  << (pg->scrubber.must_scrub ? ", explicitly requested" : "")
-                  << (t < max ? ", last_scrub < max" : "")
+         dout(10) << "sched_scrub scrubbing " << pgid << " at " << t
+                  << (pg->scrubber.must_scrub ? ", explicitly requested" :
+                  ( (double)diff >= g_conf->osd_scrub_max_interval ? ", diff >= max" : ""))
                   << dendl;
          if (pg->sched_scrub()) {
            pg->unlock();