From 4f1b372e549db0ad66b17cfd750be7f1c9bbb604 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sun, 16 Mar 2014 16:13:17 +0100 Subject: [PATCH] osd: use erasure code profile when building the PGBackend The PGBackend::build_pg_backend() prototype is modified to add an OSDMapRef which is used to get the profile stored in the pg_pool_t and pass it to the erasure code plugin. Signed-off-by: Loic Dachary --- src/osd/PGBackend.cc | 8 +++++--- src/osd/PGBackend.h | 1 + src/osd/ReplicatedPG.cc | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index b93cd51fa923a..dad17f9cd2619 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -268,6 +268,7 @@ void PGBackend::trim_stashed_object( PGBackend *PGBackend::build_pg_backend( const pg_pool_t &pool, + const OSDMapRef curmap, Listener *l, coll_t coll, coll_t temp_coll, @@ -280,11 +281,12 @@ PGBackend *PGBackend::build_pg_backend( } case pg_pool_t::TYPE_ERASURE: { ErasureCodeInterfaceRef ec_impl; - assert(pool.properties.count("erasure-code-plugin")); + const map &profile = curmap->get_erasure_code_profile(pool.erasure_code_profile); + assert(profile.count("plugin")); stringstream ss; ceph::ErasureCodePluginRegistry::instance().factory( - pool.properties.find("erasure-code-plugin")->second, - pool.properties, + profile.find("plugin")->second, + profile, &ec_impl, ss); assert(ec_impl); diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 80afbe963fd1c..f3dc0ad970c5c 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -600,6 +600,7 @@ static PGBackend *build_pg_backend( const pg_pool_t &pool, + const OSDMapRef curmap, Listener *l, coll_t coll, coll_t temp_coll, diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 7d576d6cef01a..397c31c550df4 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1033,7 +1033,7 @@ ReplicatedPG::ReplicatedPG(OSDService *o, OSDMapRef curmap, PG(o, curmap, _pool, p, oid, ioid), pgbackend( PGBackend::build_pg_backend( - _pool.info, this, coll_t(p), coll_t::make_temp_coll(p), o->store, cct)), + _pool.info, curmap, this, coll_t(p), coll_t::make_temp_coll(p), o->store, cct)), snapset_contexts_lock("ReplicatedPG::snapset_contexts"), temp_seq(0), snap_trimmer_machine(this) -- 2.39.5