From: Sage Weil Date: Mon, 18 Jan 2016 17:43:11 +0000 (-0500) Subject: osd: associate a CollectionHandle& with PGBackend X-Git-Tag: v10.0.4~153^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6560b14df96f82b575a3854914249bb024b352ea;p=ceph.git osd: associate a CollectionHandle& with PGBackend Make this a ref to the PG's handle because the backend is constructed before the handle is opened. Signed-off-by: Sage Weil --- diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index dadfeaa0b714..f1bcd85f6f98 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -171,11 +171,12 @@ void ECBackend::RecoveryOp::dump(Formatter *f) const ECBackend::ECBackend( PGBackend::Listener *pg, coll_t coll, + ObjectStore::CollectionHandle &ch, ObjectStore *store, CephContext *cct, ErasureCodeInterfaceRef ec_impl, uint64_t stripe_width) - : PGBackend(pg, store, coll), + : PGBackend(pg, store, coll, ch), cct(cct), ec_impl(ec_impl), sinfo(ec_impl->get_data_chunk_count(), stripe_width) { diff --git a/src/osd/ECBackend.h b/src/osd/ECBackend.h index bb064f849651..2f7b3b7cdfe4 100644 --- a/src/osd/ECBackend.h +++ b/src/osd/ECBackend.h @@ -466,6 +466,7 @@ public: ECBackend( PGBackend::Listener *pg, coll_t coll, + ObjectStore::CollectionHandle &ch, ObjectStore *store, CephContext *cct, ErasureCodeInterfaceRef ec_impl, diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 10bc74d94594..cc04ac8ce8fa 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -274,12 +274,13 @@ PGBackend *PGBackend::build_pg_backend( const OSDMapRef curmap, Listener *l, coll_t coll, + ObjectStore::CollectionHandle &ch, ObjectStore *store, CephContext *cct) { switch (pool.type) { case pg_pool_t::TYPE_REPLICATED: { - return new ReplicatedBackend(l, coll, store, cct); + return new ReplicatedBackend(l, coll, ch, store, cct); } case pg_pool_t::TYPE_ERASURE: { ErasureCodeInterfaceRef ec_impl; diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 1e410c76d9d3..e995f1ac3817 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -43,6 +43,7 @@ protected: ObjectStore *store; const coll_t coll; + ObjectStore::CollectionHandle &ch; public: /** * Provides interfaces for PGBackend callbacks @@ -230,9 +231,11 @@ }; Listener *parent; Listener *get_parent() const { return parent; } - PGBackend(Listener *l, ObjectStore *store, coll_t coll) : + PGBackend(Listener *l, ObjectStore *store, coll_t coll, + ObjectStore::CollectionHandle &ch) : store(store), coll(coll), + ch(ch), parent(l) {} bool is_primary() const { return get_parent()->pgb_is_primary(); } OSDMapRef get_osdmap() const { return get_parent()->pgb_get_osdmap(); } @@ -597,6 +600,7 @@ const OSDMapRef curmap, Listener *l, coll_t coll, + ObjectStore::CollectionHandle &ch, ObjectStore *store, CephContext *cct); }; diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 1ffa50decf40..72055dec068f 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -62,9 +62,10 @@ static void log_subop_stats( ReplicatedBackend::ReplicatedBackend( PGBackend::Listener *pg, coll_t coll, + ObjectStore::CollectionHandle &c, ObjectStore *store, CephContext *cct) : - PGBackend(pg, store, coll), + PGBackend(pg, store, coll, c), cct(cct) {} void ReplicatedBackend::run_recovery_op( diff --git a/src/osd/ReplicatedBackend.h b/src/osd/ReplicatedBackend.h index 7a1b72aeb963..4858fcd8cf7e 100644 --- a/src/osd/ReplicatedBackend.h +++ b/src/osd/ReplicatedBackend.h @@ -33,6 +33,7 @@ public: ReplicatedBackend( PGBackend::Listener *pg, coll_t coll, + ObjectStore::CollectionHandle &ch, ObjectStore *store, CephContext *cct); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 4d5c94db46b5..e3e9e520ecf0 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1352,7 +1352,7 @@ ReplicatedPG::ReplicatedPG(OSDService *o, OSDMapRef curmap, PG(o, curmap, _pool, p), pgbackend( PGBackend::build_pg_backend( - _pool.info, curmap, this, coll_t(p), o->store, cct)), + _pool.info, curmap, this, coll_t(p), ch, o->store, cct)), object_contexts(o->cct, g_conf->osd_pg_object_context_cache_count), snapset_contexts_lock("ReplicatedPG::snapset_contexts"), backfills_in_flight(hobject_t::Comparator(true)),