diff options
-rw-r--r-- | src/osd/PG.h | 15 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.cc | 14 |
2 files changed, 20 insertions, 9 deletions
diff --git a/src/osd/PG.h b/src/osd/PG.h index 2cf1173203d..31201cfa040 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -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; diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index cf1b1f14683..47abfdb2bd7 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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? |