From 9693d32bfdfe36a80681b24515a04eb7389bf954 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Mon, 12 Sep 2016 18:18:24 +0300 Subject: [PATCH] osd/PG: implement pool options pass to object store. Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueStore.cc | 8 ++++---- src/osd/PG.cc | 13 +++++++++++-- src/osd/PG.h | 2 ++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 40e1e50c35c..17947536435 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -7946,9 +7946,9 @@ int BlueStore::_do_write( "compression_max_blob_size", comp_max_blob_size.load(), [&]() { - uint64_t val; + int val; if(c->pool_opts.get(pool_opts_t::COMPRESSION_MAX_BLOB_SIZE, &val)) { - return boost::optional(val); + return boost::optional((uint64_t)val); } return boost::optional(); } @@ -7960,9 +7960,9 @@ int BlueStore::_do_write( "compression_min_blob_size", comp_min_blob_size.load(), [&]() { - uint64_t val; + int val; if(c->pool_opts.get(pool_opts_t::COMPRESSION_MIN_BLOB_SIZE, &val)) { - return boost::optional(val); + return boost::optional((uint64_t)val); } return boost::optional(); } diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 5557e41eea9..2945f76ad36 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5614,8 +5614,10 @@ void PG::handle_advance_map( osdmap, lastmap, newup, up_primary, newacting, acting_primary); recovery_state.handle_event(evt, rctx); - if (pool.info.last_change == osdmap_ref->get_epoch()) + if (pool.info.last_change == osdmap_ref->get_epoch()) { on_pool_change(); + update_store_with_options(); + } } void PG::handle_activate_map(RecoveryCtx *rctx) @@ -5661,7 +5663,13 @@ void PG::handle_query_state(Formatter *f) recovery_state.handle_event(q, 0); } - +void PG::update_store_with_options() +{ + auto r = osd->store->set_collection_opts(coll, pool.info.opts); + if(r < 0 && r != -EOPNOTSUPP) { + derr << __func__ << "set_collection_opts returns error:" << r << dendl; + } +} std::ostream& operator<<(std::ostream& oss, const struct PG::PriorSet &prior) @@ -5701,6 +5709,7 @@ boost::statechart::result PG::RecoveryState::Initial::react(const Load& l) // do we tell someone we're here? pg->send_notify = (!pg->is_primary()); + pg->update_store_with_options(); return transit< Reset >(); } diff --git a/src/osd/PG.h b/src/osd/PG.h index 9f53362a6c4..3bd89bb8c30 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2234,6 +2234,8 @@ public: private: void prepare_write_info(map *km); + void update_store_with_options(); + public: static int _prepare_write_info( map *km, -- 2.39.5