summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2012-12-11 22:19:09 -0800
committerSamuel Just <sam.just@inktank.com>2012-12-11 22:27:13 -0800
commit64cefe2c60b2d54e06d6b3e78db8e2890e612b98 (patch)
treeb82b4b9dda64f9b380da1e38388a9d9b143021a4
parent54618afab2d1634e1fac218a021a07c3905e5c20 (diff)
downloadceph-64cefe2c60b2d54e06d6b3e78db8e2890e612b98.tar.gz
PG,ReplicatedPG: move write_blocked_by_scrub logic into a helper
Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/osd/PG.h15
-rw-r--r--src/osd/ReplicatedPG.cc14
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?