From 37447e758eba628b3dcb21834c15e5baa4a779bb Mon Sep 17 00:00:00 2001 From: David Zafman Date: Thu, 23 Jan 2014 19:55:27 -0800 Subject: [PATCH] osd: Add scrub_supported() backend interface Signed-off-by: David Zafman --- src/osd/OSD.cc | 2 +- src/osd/PG.cc | 1 + src/osd/PGBackend.h | 3 +++ src/osd/ReplicatedBackend.h | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 299ecd61288..38bb17194a3 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4856,7 +4856,7 @@ void OSD::sched_scrub() PG *pg = _lookup_lock_pg(pgid); if (pg) { - if (pg->is_active() && + if (pg->get_pgbackend()->scrub_supported() && pg->is_active() && (load_is_low || (double)diff >= cct->_conf->osd_scrub_max_interval || pg->scrubber.must_scrub)) { diff --git a/src/osd/PG.cc b/src/osd/PG.cc index ee02a57c66d..83fa35b710d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3447,6 +3447,7 @@ void PG::scrub(ThreadPool::TPHandle &handle) */ void PG::classic_scrub(ThreadPool::TPHandle &handle) { + assert(pool.info.type == pg_pool_t::TYPE_REPLICATED); if (!scrubber.active) { dout(10) << "scrub start" << dendl; scrubber.active = true; diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 8c527d65086..81a0ee5d1fd 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -34,6 +34,7 @@ * 1) Handling client operations * 2) Handling object recovery * 3) Handling object access + * 4) Handling scrub, deep-scrub, repair */ class PGBackend { public: @@ -428,6 +429,8 @@ const list, pair > > &to_read, Context *on_complete) = 0; + + virtual bool scrub_supported() { return false; } }; #endif diff --git a/src/osd/ReplicatedBackend.h b/src/osd/ReplicatedBackend.h index b152f42b0f8..867ffa33b8b 100644 --- a/src/osd/ReplicatedBackend.h +++ b/src/osd/ReplicatedBackend.h @@ -489,6 +489,7 @@ private: }; void sub_op_modify_applied(RepModifyRef rm); void sub_op_modify_commit(RepModifyRef rm); + bool scrub_supported() { return true; } }; #endif