in
e53ea0886fba9073904f59ea85fb73d854565921, the new alien::submit_to() API
is used in the place of the old one. but seastar::alien::instance::_qs
should be initialized before we are able to use the alien instance, just
creating an instance of alien::instance is not enough.
in this change, instead of creating an instance of alien::instance using
make_unique<>, the return value of app.alien() is used to initialize the
alien member variable of AlienStore. app.alien() is always properly
initialized by reactor.
Signed-off-by: Kefu Chai <kchai@redhat.com>
using crimson::common::get_conf;
-AlienStore::AlienStore(const std::string& path, const ConfigValues& values)
+AlienStore::AlienStore(const std::string& path,
+ const ConfigValues& values,
+ seastar::alien::instance& alien)
: path{path},
- alien{std::make_unique<seastar::alien::instance>()}
+ alien{alien}
{
cct = std::make_unique<CephContext>(CEPH_ENTITY_TYPE_OSD);
g_ceph_context = cct.get();
assert(tp);
return tp->submit(ch->get_cid().hash_to_shard(tp->size()),
[this, ch, id, crimson_wrapper, &txn, &done] {
- txn.register_on_commit(new OnCommit(*alien,
+ txn.register_on_commit(new OnCommit(alien,
id, done, crimson_wrapper,
txn));
auto c = static_cast<AlienCollection*>(ch.get());
AlienStore* store;
CollectionRef ch;
};
- AlienStore(const std::string& path, const ConfigValues& values);
+ AlienStore(const std::string& path,
+ const ConfigValues& values,
+ seastar::alien::instance& alien);
~AlienStore() final;
seastar::future<> start() final;
constexpr static unsigned MAX_KEYS_PER_OMAP_GET_CALL = 32;
mutable std::unique_ptr<crimson::os::ThreadPool> tp;
const std::string path;
- std::unique_ptr<seastar::alien::instance> alien;
+ seastar::alien::instance& alien;
uint64_t used_bytes = 0;
std::unique_ptr<ObjectStore> store;
std::unique_ptr<CephContext> cct;
std::unique_ptr<FuturizedStore>
FuturizedStore::create(const std::string& type,
const std::string& data,
- const ConfigValues& values)
+ const ConfigValues& values,
+ seastar::alien::instance& alien)
{
if (type == "memstore") {
return std::make_unique<crimson::os::CyanStore>(data);
} else if (type == "bluestore") {
- return std::make_unique<crimson::os::AlienStore>(data, values);
+ return std::make_unique<crimson::os::AlienStore>(data, values, alien);
} else if (type == "seastore") {
return crimson::os::seastore::make_seastore(data, values);
} else {
#include "include/uuid.h"
#include "osd/osd_types.h"
+namespace seastar::alien {
+class instance;
+}
+
namespace ceph::os {
class Transaction;
}
static std::unique_ptr<FuturizedStore> create(const std::string& type,
const std::string& data,
- const ConfigValues& values);
+ const ConfigValues& values,
+ seastar::alien::instance& alien);
FuturizedStore() = default;
virtual ~FuturizedStore() = default;
configure_crc_handling(*msgr);
}
osd.start_single(whoami, nonce,
+ std::ref(app.alien()),
cluster_msgr, client_msgr,
hb_front_msgr, hb_back_msgr).get();
auto stop_osd = seastar::defer([&] {
namespace crimson::osd {
OSD::OSD(int id, uint32_t nonce,
+ seastar::alien::instance& alien,
crimson::net::MessengerRef cluster_msgr,
crimson::net::MessengerRef public_msgr,
crimson::net::MessengerRef hb_front_msgr,
store{crimson::os::FuturizedStore::create(
local_conf().get_val<std::string>("osd_objectstore"),
local_conf().get_val<std::string>("osd_data"),
- local_conf().get_config_values())},
+ local_conf().get_config_values(),
+ alien)},
shard_services{*this, whoami, *cluster_msgr, *public_msgr, *monc, *mgrc, *store},
heartbeat{new Heartbeat{whoami, shard_services, *monc, hb_front_msgr, hb_back_msgr}},
// do this in background
class OSDMeta;
class Heartbeat;
+namespace seastar::alien {
+ class instance;
+}
+
namespace ceph::os {
class Transaction;
}
public:
OSD(int id, uint32_t nonce,
+ seastar::alien::instance& alien,
crimson::net::MessengerRef cluster_msgr,
crimson::net::MessengerRef client_msgr,
crimson::net::MessengerRef hb_front_msgr,