mirror of
https://github.com/ceph/ceph
synced 2025-02-23 19:17:37 +00:00
PG,ReplicatedPG: move write_blocked_by_scrub logic into a helper
Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
parent
54618afab2
commit
64cefe2c60
15
src/osd/PG.h
15
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;
|
||||
|
@ -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?
|
||||
|
Loading…
Reference in New Issue
Block a user