]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG,ReplicatedPG: move write_blocked_by_scrub logic into a helper
authorSamuel Just <sam.just@inktank.com>
Wed, 12 Dec 2012 06:19:09 +0000 (22:19 -0800)
committerSamuel Just <sam.just@inktank.com>
Wed, 12 Dec 2012 06:27:13 +0000 (22:27 -0800)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/PG.h
src/osd/ReplicatedPG.cc

index 2cf1173203dd5e8a5fa8d53cf07cfaa9a228501b..31201cfa04037495063cca90b8df22a5aed037ce 100644 (file)
@@ -875,6 +875,21 @@ public:
 
     bool is_chunky_scrub_active() const { return state != INACTIVE; }
 
+    // classic (non chunk) scrubs block all writes
+    // chunky scrubs only block writes to a range
+    bool write_blocked_by_scrub(const hobject_t &soid) {
+      if (!block_writes)
+       return false;
+
+      if (!is_chunky)
+       return true;
+
+      if (soid >= start && soid < end)
+       return true;
+
+      return false;
+    }
+
     // clear all state
     void reset() {
       finalizing = false;
index cf1b1f14683c310b9b80f64d8a73f499c03a3ba0..47abfdb2bd7f3a87faaef2fe72def0f03cdd4448 100644 (file)
@@ -628,15 +628,11 @@ void ReplicatedPG::do_op(OpRequestRef op)
                 CEPH_NOSNAP, m->get_pg().ps(),
                 info.pgid.pool());
 
-  if (scrubber.block_writes && m->may_write()) {
-    // classic (non chunk) scrubs block all writes
-    // chunky scrubs only block writes to a range
-    if (!scrubber.is_chunky || (head >= scrubber.start && head < scrubber.end)) {
-      dout(20) << __func__ << ": waiting for scrub" << dendl;
-      waiting_for_active.push_back(op);
-      op->mark_delayed();
-      return;
-    }
+  if (m->may_write() && scrubber.write_blocked_by_scrub(head)) {
+    dout(20) << __func__ << ": waiting for scrub" << dendl;
+    waiting_for_active.push_back(op);
+    op->mark_delayed();
+    return;
   }
 
   // missing object?