diff options
author | Kefu Chai <kchai@redhat.com> | 2019-10-23 10:08:38 +0200 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2019-10-24 06:37:30 +0200 |
commit | 4589fff6bff8dadd7347fccfc62ed4a49e2b101d (patch) | |
tree | 3643bcc9d3e29c60378980897cda62f58c3b2884 /src | |
parent | crimson/osd/osd_operation.h: s/ceph_assert/assert/ (diff) | |
download | ceph-4589fff6bff8dadd7347fccfc62ed4a49e2b101d.tar.xz ceph-4589fff6bff8dadd7347fccfc62ed4a49e2b101d.zip |
crimson: s/ceph/crimson/ in namespace names
to help differentiate the symbols shared by classic and crimson osd,
after this change, all crimson code will live in "crimson::" namespaces.
and in a follow-up change, all classic code used by crimson will live in
"ceph::" namespaces.
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src')
112 files changed, 825 insertions, 804 deletions
diff --git a/src/auth/cephx/CephxSessionHandler.cc b/src/auth/cephx/CephxSessionHandler.cc index 966f87197d7..d1417d6caf7 100644 --- a/src/auth/cephx/CephxSessionHandler.cc +++ b/src/auth/cephx/CephxSessionHandler.cc @@ -26,8 +26,8 @@ namespace { #ifdef WITH_SEASTAR - ceph::common::ConfigProxy& conf(CephContext*) { - return ceph::common::local_conf(); + crimson::common::ConfigProxy& conf(CephContext*) { + return crimson::common::local_conf(); } #else ConfigProxy& conf(CephContext* cct) { diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 17c45e51edb..93c70970a79 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -56,8 +56,8 @@ using ceph::HeartbeatMap; #ifdef WITH_SEASTAR CephContext::CephContext() - : _conf{ceph::common::local_conf()}, - _perf_counters_collection{ceph::common::local_perf_coll()}, + : _conf{crimson::common::local_conf()}, + _perf_counters_collection{crimson::common::local_perf_coll()}, _crypto_random{std::make_unique<CryptoRandom>()} {} diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index 684e89cdf53..6b6e9482b99 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -75,8 +75,8 @@ public: } CryptoRandom* random() const; PerfCountersCollectionImpl* get_perfcounters_collection(); - ceph::common::ConfigProxy& _conf; - ceph::common::PerfCountersCollection& _perf_counters_collection; + crimson::common::ConfigProxy& _conf; + crimson::common::PerfCountersCollection& _perf_counters_collection; CephContext* get(); void put(); private: diff --git a/src/common/config_fwd.h b/src/common/config_fwd.h index 817d1a0f8b0..c7e4c3f02a0 100644 --- a/src/common/config_fwd.h +++ b/src/common/config_fwd.h @@ -3,10 +3,10 @@ #pragma once #ifdef WITH_SEASTAR -namespace ceph::common { +namespace crimson::common { class ConfigProxy; } -using ConfigProxy = ceph::common::ConfigProxy; +using ConfigProxy = crimson::common::ConfigProxy; #else class ConfigProxy; #endif diff --git a/src/common/config_values.cc b/src/common/config_values.cc index 7acf19ec866..f4a0a19595c 100644 --- a/src/common/config_values.cc +++ b/src/common/config_values.cc @@ -79,7 +79,7 @@ void ConfigValues::set_logging(int which, const char* val) subsys.set_log_level(which, log); subsys.set_gather_level(which, gather); #if WITH_SEASTAR - ceph::get_logger(which).set_level(ceph::to_log_level(log)); + crimson::get_logger(which).set_level(crimson::to_log_level(log)); #endif } } diff --git a/src/common/dout.h b/src/common/dout.h index 415678e4992..2fdc07a19a6 100644 --- a/src/common/dout.h +++ b/src/common/dout.h @@ -120,14 +120,14 @@ struct is_dynamic<dynamic_marker_t<T>> : public std::true_type {}; #ifdef WITH_SEASTAR #define dout_impl(cct, sub, v) \ do { \ - if (ceph::common::local_conf()->subsys.should_gather(sub, v)) { \ - seastar::logger& _logger = ceph::get_logger(sub); \ + if (crimson::common::local_conf()->subsys.should_gather(sub, v)) { \ + seastar::logger& _logger = crimson::get_logger(sub); \ const auto _lv = v; \ std::ostringstream _out; \ std::ostream* _dout = &_out; #define dendl_impl \ ""; \ - _logger.log(ceph::to_log_level(_lv), \ + _logger.log(crimson::to_log_level(_lv), \ _out.str().c_str()); \ } \ } while (0) diff --git a/src/crimson/auth/AuthClient.h b/src/crimson/auth/AuthClient.h index d75e663429e..cd21b3838d7 100644 --- a/src/crimson/auth/AuthClient.h +++ b/src/crimson/auth/AuthClient.h @@ -12,7 +12,7 @@ class CryptoKey; -namespace ceph::auth { +namespace crimson::auth { class error : public std::logic_error { public: @@ -34,14 +34,14 @@ public: /// Build an authentication request to begin the handshake /// /// @throw auth::error if unable to build the request - virtual auth_request_t get_auth_request(ceph::net::ConnectionRef conn, + virtual auth_request_t get_auth_request(crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta) = 0; /// Handle server's request to continue the handshake /// /// @throw auth::error if unable to build the request virtual ceph::bufferlist handle_auth_reply_more( - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, const ceph::bufferlist& bl) = 0; @@ -49,7 +49,7 @@ public: /// /// @return 0 if authenticated, a negative number otherwise virtual int handle_auth_done( - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, uint64_t global_id, uint32_t con_mode, @@ -60,7 +60,7 @@ public: /// @return 0 if will try next auth method, a negative number if we have no /// more options virtual int handle_auth_bad_method( - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, uint32_t old_auth_method, int result, @@ -68,4 +68,4 @@ public: const std::vector<uint32_t>& allowed_modes) = 0; }; -} // namespace ceph::auth +} // namespace crimson::auth diff --git a/src/crimson/auth/AuthServer.h b/src/crimson/auth/AuthServer.h index bca0b43871a..d75c8f58649 100644 --- a/src/crimson/auth/AuthServer.h +++ b/src/crimson/auth/AuthServer.h @@ -10,7 +10,7 @@ struct AuthAuthorizeHandler; -namespace ceph::auth { +namespace crimson::auth { class AuthServer { public: @@ -30,7 +30,7 @@ public: int auth_method) = 0; // Handle an authentication request on an incoming connection virtual int handle_auth_request( - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, bool more, //< true if this is not the first part of the handshake uint32_t auth_method, @@ -38,4 +38,4 @@ public: bufferlist *reply) = 0; }; -} // namespace ceph::auth +} // namespace crimson::auth diff --git a/src/crimson/auth/DummyAuth.h b/src/crimson/auth/DummyAuth.h index 6162af7dec3..7c26140a227 100644 --- a/src/crimson/auth/DummyAuth.h +++ b/src/crimson/auth/DummyAuth.h @@ -4,7 +4,7 @@ #include "AuthClient.h" #include "AuthServer.h" -namespace ceph::auth { +namespace crimson::auth { class DummyAuthClientServer : public AuthClient, public AuthServer { @@ -32,20 +32,20 @@ public: } AuthClient::auth_request_t get_auth_request( - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta) override { return {CEPH_AUTH_NONE, {CEPH_CON_MODE_CRC}, {}}; } ceph::bufferlist handle_auth_reply_more( - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, const bufferlist& bl) override { ceph_abort(); } int handle_auth_done( - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, uint64_t global_id, uint32_t con_mode, @@ -54,7 +54,7 @@ public: } int handle_auth_bad_method( - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, uint32_t old_auth_method, int result, @@ -65,7 +65,7 @@ public: // server int handle_auth_request( - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, bool more, uint32_t auth_method, @@ -75,4 +75,4 @@ public: } }; -} // namespace ceph::auth +} // namespace crimson::auth diff --git a/src/crimson/auth/KeyRing.cc b/src/crimson/auth/KeyRing.cc index 5f82a262caf..7fe4f5edf78 100644 --- a/src/crimson/auth/KeyRing.cc +++ b/src/crimson/auth/KeyRing.cc @@ -15,7 +15,7 @@ #include "include/denc.h" #include "crimson/common/config_proxy.h" -namespace ceph::auth { +namespace crimson::auth { seastar::future<seastar::temporary_buffer<char>> read_file(const std::string& path) { @@ -31,7 +31,7 @@ seastar::future<seastar::temporary_buffer<char>> read_file(const std::string& pa seastar::future<KeyRing*> load_from_keyring(KeyRing* keyring) { std::vector<std::string> paths; - boost::split(paths, ceph::common::local_conf()->keyring, + boost::split(paths, crimson::common::local_conf()->keyring, boost::is_any_of(",;")); std::pair<bool, std::string> found; return seastar::map_reduce(paths, [](auto path) { @@ -61,13 +61,13 @@ seastar::future<KeyRing*> load_from_keyring(KeyRing* keyring) seastar::future<KeyRing*> load_from_keyfile(KeyRing* keyring) { - auto& path = ceph::common::local_conf()->keyfile; + auto& path = crimson::common::local_conf()->keyfile; if (!path.empty()) { return read_file(path).then([keyring](auto buf) { EntityAuth ea; ea.key.decode_base64(std::string(buf.begin(), buf.end())); - keyring->add(ceph::common::local_conf()->name, ea); + keyring->add(crimson::common::local_conf()->name, ea); return seastar::make_ready_future<KeyRing*>(keyring); }); } else { @@ -77,13 +77,13 @@ seastar::future<KeyRing*> load_from_keyfile(KeyRing* keyring) seastar::future<KeyRing*> load_from_key(KeyRing* keyring) { - auto& key = ceph::common::local_conf()->key; + auto& key = crimson::common::local_conf()->key; if (!key.empty()) { EntityAuth ea; ea.key.decode_base64(key); - keyring->add(ceph::common::local_conf()->name, ea); + keyring->add(crimson::common::local_conf()->name, ea); } return seastar::make_ready_future<KeyRing*>(keyring); } -} // namespace ceph::auth +} // namespace crimson::auth diff --git a/src/crimson/auth/KeyRing.h b/src/crimson/auth/KeyRing.h index b68e638939c..850f1bb7973 100644 --- a/src/crimson/auth/KeyRing.h +++ b/src/crimson/auth/KeyRing.h @@ -7,7 +7,7 @@ class KeyRing; -namespace ceph::auth { +namespace crimson::auth { // see KeyRing::from_ceph_context seastar::future<KeyRing*> load_from_keyring(KeyRing* keyring); seastar::future<KeyRing*> load_from_keyfile(KeyRing* keyring); diff --git a/src/crimson/common/assert.cc b/src/crimson/common/assert.cc index c5b4f6235ef..07610c33f89 100644 --- a/src/crimson/common/assert.cc +++ b/src/crimson/common/assert.cc @@ -18,7 +18,7 @@ namespace ceph { const char* file, int line, const char* func) { - seastar::logger& logger = ceph::get_logger(0); + seastar::logger& logger = crimson::get_logger(0); logger.error("{}:{} : In function '{}', ceph_assert(%s)\n" "{}", file, line, func, assertion, @@ -37,7 +37,7 @@ namespace ceph { std::vsnprintf(buf, sizeof(buf), msg, args); va_end(args); - seastar::logger& logger = ceph::get_logger(0); + seastar::logger& logger = crimson::get_logger(0); logger.error("{}:{} : In function '{}', ceph_assert(%s)\n" "{}\n{}\n", file, line, func, assertion, @@ -50,7 +50,7 @@ namespace ceph { [[gnu::cold]] void __ceph_abort(const char* file, int line, const char* func, const std::string& msg) { - seastar::logger& logger = ceph::get_logger(0); + seastar::logger& logger = crimson::get_logger(0); logger.error("{}:{} : In function '{}', abort(%s)\n" "{}", file, line, func, msg, @@ -69,7 +69,7 @@ namespace ceph { std::vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); - seastar::logger& logger = ceph::get_logger(0); + seastar::logger& logger = crimson::get_logger(0); logger.error("{}:{} : In function '{}', abort()\n" "{}\n{}\n", file, line, func, diff --git a/src/crimson/common/auth_handler.h b/src/crimson/common/auth_handler.h index 922df6486dd..d4140b6a2dd 100644 --- a/src/crimson/common/auth_handler.h +++ b/src/crimson/common/auth_handler.h @@ -6,7 +6,7 @@ class EntityName; class AuthCapsInfo; -namespace ceph::common { +namespace crimson::common { class AuthHandler { public: // the peer just got authorized diff --git a/src/crimson/common/config_proxy.cc b/src/crimson/common/config_proxy.cc index 720fcffddae..e47af1e7bef 100644 --- a/src/crimson/common/config_proxy.cc +++ b/src/crimson/common/config_proxy.cc @@ -2,7 +2,7 @@ #include "config_proxy.h" -namespace ceph::common { +namespace crimson::common { ConfigProxy::ConfigProxy(const EntityName& name, std::string_view cluster) { diff --git a/src/crimson/common/config_proxy.h b/src/crimson/common/config_proxy.h index 28fa2069b1a..0f78e42e6fe 100644 --- a/src/crimson/common/config_proxy.h +++ b/src/crimson/common/config_proxy.h @@ -9,7 +9,7 @@ #include "common/config_obs_mgr.h" #include "common/errno.h" -namespace ceph::common { +namespace crimson::common { // a facade for managing config. each shard has its own copy of ConfigProxy. // @@ -151,7 +151,7 @@ public: seastar::future<> parse_argv(std::vector<const char*>& argv) { // we could pass whatever is unparsed to seastar, but seastar::app_template // is used for driving the seastar application, and - // ceph::common::ConfigProxy is not available until seastar engine is up + // crimson::common::ConfigProxy is not available until seastar engine is up // and running, so we have to feed the command line args to app_template // first, then pass them to ConfigProxy. return do_change([&argv, this](ConfigValues& values) { diff --git a/src/crimson/common/log.cc b/src/crimson/common/log.cc index 6a57b233516..397337777b8 100644 --- a/src/crimson/common/log.cc +++ b/src/crimson/common/log.cc @@ -10,7 +10,7 @@ static std::array<seastar::logger, ceph_subsys_get_num()> loggers{ #undef DEFAULT_SUBSYS }; -namespace ceph { +namespace crimson { seastar::logger& get_logger(int subsys) { assert(subsys < ceph_subsys_max); return loggers[subsys]; diff --git a/src/crimson/common/log.h b/src/crimson/common/log.h index 9f1949fd254..132ddd2dc8e 100644 --- a/src/crimson/common/log.h +++ b/src/crimson/common/log.h @@ -3,7 +3,7 @@ #include <seastar/util/log.hh> #include "common/subsys_types.h" -namespace ceph { +namespace crimson { seastar::logger& get_logger(int subsys); static inline seastar::log_level to_log_level(int level) { if (level < 0) { diff --git a/src/crimson/common/perf_counters_collection.cc b/src/crimson/common/perf_counters_collection.cc index 7a19a9f2d82..d3192338660 100644 --- a/src/crimson/common/perf_counters_collection.cc +++ b/src/crimson/common/perf_counters_collection.cc @@ -1,6 +1,6 @@ #include "perf_counters_collection.h" -namespace ceph::common { +namespace crimson::common { PerfCountersCollection::PerfCountersCollection() { perf_collection = std::make_unique<PerfCountersCollectionImpl>(); diff --git a/src/crimson/common/perf_counters_collection.h b/src/crimson/common/perf_counters_collection.h index 95e2a4f2115..8d7727e452d 100644 --- a/src/crimson/common/perf_counters_collection.h +++ b/src/crimson/common/perf_counters_collection.h @@ -3,7 +3,7 @@ #include "common/perf_counters.h" #include <seastar/core/sharded.hh> -namespace ceph::common { +namespace crimson::common { class PerfCountersCollection: public seastar::sharded<PerfCountersCollection> { using ShardedPerfCountersCollection = seastar::sharded<PerfCountersCollection>; diff --git a/src/crimson/mgr/client.cc b/src/crimson/mgr/client.cc index 4a29c6198bc..845c02f256e 100644 --- a/src/crimson/mgr/client.cc +++ b/src/crimson/mgr/client.cc @@ -10,23 +10,16 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_mgrc); - } - template<typename Message, typename... Args> - Ref<Message> make_message(Args&&... args) - { - // Message inherits from RefCountedObject, whose nref is 1 when it is - // constructed, so we pass "add_ref = false" to intrusive_ptr's ctor - return {new Message{std::forward<Args>(args)...}, false}; + return crimson::get_logger(ceph_subsys_mgrc); } } -using ceph::common::local_conf; +using crimson::common::local_conf; -namespace ceph::mgr +namespace crimson::mgr { -Client::Client(ceph::net::Messenger& msgr, +Client::Client(crimson::net::Messenger& msgr, WithStats& with_stats) : msgr{msgr}, with_stats{with_stats}, @@ -49,7 +42,7 @@ seastar::future<> Client::stop() }); } -seastar::future<> Client::ms_dispatch(ceph::net::Connection* conn, +seastar::future<> Client::ms_dispatch(crimson::net::Connection* conn, MessageRef m) { switch(m->get_type()) { @@ -62,7 +55,7 @@ seastar::future<> Client::ms_dispatch(ceph::net::Connection* conn, } } -seastar::future<> Client::ms_handle_reset(ceph::net::ConnectionRef c) +seastar::future<> Client::ms_handle_reset(crimson::net::ConnectionRef c) { if (conn == c) { return reconnect(); @@ -83,14 +76,14 @@ seastar::future<> Client::reconnect() [this](auto xconn) { conn = xconn->release(); // ask for the mgrconfigure message - auto m = make_message<MMgrOpen>(); + auto m = ceph::make_message<MMgrOpen>(); m->daemon_name = local_conf()->name.get_id(); return conn->send(std::move(m)); }); }); } -seastar::future<> Client::handle_mgr_map(ceph::net::Connection*, +seastar::future<> Client::handle_mgr_map(crimson::net::Connection*, Ref<MMgrMap> m) { mgrmap = m->get_map(); @@ -104,7 +97,7 @@ seastar::future<> Client::handle_mgr_map(ceph::net::Connection*, } } -seastar::future<> Client::handle_mgr_conf(ceph::net::Connection* conn, +seastar::future<> Client::handle_mgr_conf(crimson::net::Connection* conn, Ref<MMgrConfigure> m) { logger().info("{} {}", __func__, *m); diff --git a/src/crimson/mgr/client.h b/src/crimson/mgr/client.h index 1a63b60fb68..fa4ae39df34 100644 --- a/src/crimson/mgr/client.h +++ b/src/crimson/mgr/client.h @@ -11,14 +11,14 @@ #include "mon/MgrMap.h" template<typename Message> using Ref = boost::intrusive_ptr<Message>; -namespace ceph::net { +namespace crimson::net { class Messenger; } class MMgrMap; class MMgrConfigure; -namespace ceph::mgr +namespace crimson::mgr { // implement WithStats if you want to report stats to mgr periodically @@ -30,28 +30,28 @@ public: virtual ~WithStats() {} }; -class Client : public ceph::net::Dispatcher { +class Client : public crimson::net::Dispatcher { public: - Client(ceph::net::Messenger& msgr, + Client(crimson::net::Messenger& msgr, WithStats& with_stats); seastar::future<> start(); seastar::future<> stop(); private: - seastar::future<> ms_dispatch(ceph::net::Connection* conn, + seastar::future<> ms_dispatch(crimson::net::Connection* conn, Ref<Message> m) override; - seastar::future<> ms_handle_reset(ceph::net::ConnectionRef conn) override; - seastar::future<> handle_mgr_map(ceph::net::Connection* conn, + seastar::future<> ms_handle_reset(crimson::net::ConnectionRef conn) override; + seastar::future<> handle_mgr_map(crimson::net::Connection* conn, Ref<MMgrMap> m); - seastar::future<> handle_mgr_conf(ceph::net::Connection* conn, + seastar::future<> handle_mgr_conf(crimson::net::Connection* conn, Ref<MMgrConfigure> m); seastar::future<> reconnect(); void report(); private: MgrMap mgrmap; - ceph::net::Messenger& msgr; + crimson::net::Messenger& msgr; WithStats& with_stats; - ceph::net::ConnectionRef conn; + crimson::net::ConnectionRef conn; std::chrono::seconds report_period{0}; seastar::timer<seastar::lowres_clock> report_timer; seastar::gate gate; diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index 7ef75567131..8aa0b2589d0 100644 --- a/src/crimson/mon/MonClient.cc +++ b/src/crimson/mon/MonClient.cc @@ -35,24 +35,18 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_monc); - } - - template<typename Message, typename... Args> - Ref<Message> make_message(Args&&... args) - { - return {new Message{std::forward<Args>(args)...}, false}; + return crimson::get_logger(ceph_subsys_monc); } } -namespace ceph::mon { +namespace crimson::mon { -using ceph::common::local_conf; +using crimson::common::local_conf; class Connection { public: Connection(const AuthRegistry& auth_registry, - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, KeyRing* keyring); enum class AuthResult { success = 0, @@ -89,12 +83,12 @@ public: seastar::future<> renew_tickets(); seastar::future<> renew_rotating_keyring(); - ceph::net::ConnectionRef get_conn(); + crimson::net::ConnectionRef get_conn(); private: seastar::future<> setup_session(epoch_t epoch, const EntityName& name); - std::unique_ptr<AuthClientHandler> create_auth(ceph::auth::method_t, + std::unique_ptr<AuthClientHandler> create_auth(crimson::auth::method_t, uint64_t global_id, const EntityName& name, uint32_t want_keys); @@ -112,11 +106,11 @@ private: // v2 using clock_t = seastar::lowres_system_clock; clock_t::time_point auth_start; - ceph::auth::method_t auth_method = 0; + crimson::auth::method_t auth_method = 0; seastar::promise<AuthResult> auth_done; // v1 and v2 const AuthRegistry& auth_registry; - ceph::net::ConnectionRef conn; + crimson::net::ConnectionRef conn; std::unique_ptr<AuthClientHandler> auth; std::unique_ptr<RotatingKeyRing> rotating_keyring; uint64_t global_id = 0; @@ -124,7 +118,7 @@ private: }; Connection::Connection(const AuthRegistry& auth_registry, - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, KeyRing* keyring) : auth_registry{auth_registry}, conn{conn}, @@ -148,7 +142,7 @@ seastar::future<> Connection::renew_tickets() if (r != AuthResult::success) { throw std::system_error( make_error_code( - ceph::net::error::negotiation_failure)); + crimson::net::error::negotiation_failure)); } }); } @@ -159,7 +153,7 @@ seastar::future<> Connection::renew_rotating_keyring() { auto now = clock_t::now(); auto ttl = std::chrono::seconds{ - static_cast<long>(ceph::common::local_conf()->auth_service_ticket_ttl)}; + static_cast<long>(crimson::common::local_conf()->auth_service_ticket_ttl)}; auto cutoff = now - ttl / 4; if (!rotating_keyring->need_new_secrets(utime_t(cutoff))) { return seastar::now(); @@ -172,7 +166,7 @@ seastar::future<> Connection::renew_rotating_keyring() return do_auth(request_t::rotating).then([](AuthResult r) { if (r != AuthResult::success) { throw std::system_error(make_error_code( - ceph::net::error::negotiation_failure)); + crimson::net::error::negotiation_failure)); } }); } @@ -191,7 +185,7 @@ KeyStore& Connection::get_keys() { } std::unique_ptr<AuthClientHandler> -Connection::create_auth(ceph::auth::method_t protocol, +Connection::create_auth(crimson::auth::method_t protocol, uint64_t global_id, const EntityName& name, uint32_t want_keys) @@ -204,7 +198,7 @@ Connection::create_auth(ceph::auth::method_t protocol, if (!auth) { logger().error("no handler for protocol {}", protocol); throw std::system_error(make_error_code( - ceph::net::error::negotiation_failure)); + crimson::net::error::negotiation_failure)); } auth->init(name); auth->set_want_keys(want_keys); @@ -216,12 +210,12 @@ seastar::future<> Connection::setup_session(epoch_t epoch, const EntityName& name) { - auto m = make_message<MAuth>(); + auto m = ceph::make_message<MAuth>(); m->protocol = CEPH_AUTH_UNKNOWN; m->monmap_epoch = epoch; __u8 struct_v = 1; encode(struct_v, m->auth_payload); - std::vector<ceph::auth::method_t> auth_methods; + std::vector<crimson::auth::method_t> auth_methods; auth_registry.get_supported_methods(conn->get_peer_type(), &auth_methods); encode(auth_methods, m->auth_payload); encode(name, m->auth_payload); @@ -243,7 +237,7 @@ Connection::do_auth_single(Connection::request_t what) if (int ret = auth->build_request(m->auth_payload); ret) { logger().error("missing/bad key for '{}'", local_conf()->name); throw std::system_error(make_error_code( - ceph::net::error::negotiation_failure)); + crimson::net::error::negotiation_failure)); } break; default: @@ -338,11 +332,11 @@ Connection::get_auth_request(const EntityName& entity_name, { // choose method auth_method = [&] { - std::vector<ceph::auth::method_t> methods; + std::vector<crimson::auth::method_t> methods; auth_registry.get_supported_methods(conn->get_peer_type(), &methods); if (methods.empty()) { logger().info("get_auth_request no methods is supported"); - throw ceph::auth::error("no methods is supported"); + throw crimson::auth::error("no methods is supported"); } return methods.front(); }(); @@ -352,7 +346,7 @@ Connection::get_auth_request(const EntityName& entity_name, &modes); logger().info("method {} preferred_modes {}", auth_method, modes); if (modes.empty()) { - throw ceph::auth::error("no modes is supported"); + throw crimson::auth::error("no modes is supported"); } auth = create_auth(auth_method, global_id, entity_name, want_keys); @@ -382,7 +376,7 @@ Connection::handle_auth_reply_more(const ceph::buffer::list& payload) return {session_key, connection_secret, reply}; } else if (r < 0) { logger().error(" handle_response returned {}", r); - throw ceph::auth::error("unable to build auth"); + throw crimson::auth::error("unable to build auth"); } else { logger().info("authenticated!"); std::terminate(); @@ -422,7 +416,7 @@ int Connection::handle_auth_bad_method(uint32_t old_auth_method, logger().error("server allowed_methods {} but i only support {}", allowed_methods, auth_supported); auth_done.set_exception(std::system_error(make_error_code( - ceph::net::error::negotiation_failure))); + crimson::net::error::negotiation_failure))); return -EACCES; } auth_method = *p; @@ -449,12 +443,12 @@ bool Connection::is_my_peer(const entity_addr_t& addr) const return conn->get_peer_addr() == addr; } -ceph::net::ConnectionRef Connection::get_conn() { +crimson::net::ConnectionRef Connection::get_conn() { return conn; } -Client::Client(ceph::net::Messenger& messenger, - ceph::common::AuthHandler& auth_handler) +Client::Client(crimson::net::Messenger& messenger, + crimson::common::AuthHandler& auth_handler) // currently, crimson is OSD-only : want_keys{CEPH_ENTITY_TYPE_MON | CEPH_ENTITY_TYPE_OSD | @@ -469,10 +463,10 @@ Client::Client(Client&&) = default; Client::~Client() = default; seastar::future<> Client::start() { - entity_name = ceph::common::local_conf()->name; + entity_name = crimson::common::local_conf()->name; auth_registry.refresh_config(); return load_keyring().then([this] { - return monmap.build_initial(ceph::common::local_conf(), false); + return monmap.build_initial(crimson::common::local_conf(), false); }).then([this] { return authenticate(); }).then([this] { @@ -489,10 +483,10 @@ seastar::future<> Client::load_keyring() if (!auth_registry.is_supported_method(msgr.get_mytype(), CEPH_AUTH_CEPHX)) { return seastar::now(); } else { - return ceph::auth::load_from_keyring(&keyring).then([](KeyRing* keyring) { - return ceph::auth::load_from_keyfile(keyring); + return crimson::auth::load_from_keyring(&keyring).then([](KeyRing* keyring) { + return crimson::auth::load_from_keyfile(keyring); }).then([](KeyRing* keyring) { - return ceph::auth::load_from_key(keyring); + return crimson::auth::load_from_key(keyring); }).then([](KeyRing*) { return seastar::now(); }); @@ -517,7 +511,7 @@ bool Client::is_hunting() const { } seastar::future<> -Client::ms_dispatch(ceph::net::Connection* conn, MessageRef m) +Client::ms_dispatch(crimson::net::Connection* conn, MessageRef m) { // we only care about these message types switch (m->get_type()) { @@ -546,7 +540,7 @@ Client::ms_dispatch(ceph::net::Connection* conn, MessageRef m) } } -seastar::future<> Client::ms_handle_reset(ceph::net::ConnectionRef conn) +seastar::future<> Client::ms_handle_reset(crimson::net::ConnectionRef conn) { auto found = std::find_if(pending_conns.begin(), pending_conns.end(), [peer_addr = conn->get_peer_addr()](auto& mc) { @@ -588,7 +582,7 @@ AuthAuthorizeHandler* Client::get_auth_authorize_handler(int peer_type, } -int Client::handle_auth_request(ceph::net::ConnectionRef con, +int Client::handle_auth_request(crimson::net::ConnectionRef con, AuthConnectionMetaRef auth_meta, bool more, uint32_t auth_method, @@ -654,7 +648,7 @@ int Client::handle_auth_request(ceph::net::ConnectionRef con, } auth::AuthClient::auth_request_t -Client::get_auth_request(ceph::net::ConnectionRef con, +Client::get_auth_request(crimson::net::ConnectionRef con, AuthConnectionMetaRef auth_meta) { logger().info("get_auth_request(con={}, auth_method={})", @@ -666,20 +660,20 @@ Client::get_auth_request(ceph::net::ConnectionRef con, return mc->is_my_peer(peer_addr); }); if (found == pending_conns.end()) { - throw ceph::auth::error{"unknown connection"}; + throw crimson::auth::error{"unknown connection"}; } return (*found)->get_auth_request(entity_name, want_keys); } else { // generate authorizer if (!active_con) { logger().error(" but no auth handler is set up"); - throw ceph::auth::error("no auth available"); + throw crimson::auth::error("no auth available"); } auto authorizer = active_con->get_authorizer(con->get_peer_type()); if (!authorizer) { logger().error("failed to build_authorizer for type {}", ceph_entity_type_name(con->get_peer_type())); - throw ceph::auth::error("unable to build auth"); + throw crimson::auth::error("unable to build auth"); } auth_meta->authorizer.reset(authorizer); auth_meta->auth_method = authorizer->protocol; @@ -691,7 +685,7 @@ Client::get_auth_request(ceph::net::ConnectionRef con, } } - ceph::bufferlist Client::handle_auth_reply_more(ceph::net::ConnectionRef conn, +ceph::bufferlist Client::handle_auth_reply_more(crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, const bufferlist& bl) { @@ -701,7 +695,7 @@ Client::get_auth_request(ceph::net::ConnectionRef con, return mc->is_my_peer(peer_addr); }); if (found == pending_conns.end()) { - throw ceph::auth::error{"unknown connection"}; + throw crimson::auth::error{"unknown connection"}; } bufferlist reply; tie(auth_meta->session_key, auth_meta->connection_secret, reply) = @@ -711,14 +705,14 @@ Client::get_auth_request(ceph::net::ConnectionRef con, // authorizer challenges if (!active_con || !auth_meta->authorizer) { logger().error("no authorizer?"); - throw ceph::auth::error("no auth available"); + throw crimson::auth::error("no auth available"); } auth_meta->authorizer->add_challenge(&cct, bl); return auth_meta->authorizer->bl; } } -int Client::handle_auth_done(ceph::net::ConnectionRef conn, +int Client::handle_auth_done(crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, uint64_t global_id, uint32_t con_mode, @@ -749,7 +743,7 @@ int Client::handle_auth_done(ceph::net::ConnectionRef conn, } // Handle server's indication that the previous auth attempt failed -int Client::handle_auth_bad_method(ceph::net::ConnectionRef conn, +int Client::handle_auth_bad_method(crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, uint32_t old_auth_method, int result, @@ -776,7 +770,7 @@ int Client::handle_auth_bad_method(ceph::net::ConnectionRef conn, } } -seastar::future<> Client::handle_monmap(ceph::net::Connection* conn, +seastar::future<> Client::handle_monmap(crimson::net::Connection* conn, Ref<MMonMap> m) { monmap.decode(m->monmapbl); @@ -803,7 +797,7 @@ seastar::future<> Client::handle_monmap(ceph::net::Connection* conn, } } -seastar::future<> Client::handle_auth_reply(ceph::net::Connection* conn, +seastar::future<> Client::handle_auth_reply(crimson::net::Connection* conn, Ref<MAuthReply> m) { logger().info( @@ -882,7 +876,7 @@ seastar::future<> Client::handle_log_ack(Ref<MLogAck> m) seastar::future<> Client::handle_config(Ref<MConfig> m) { - return ceph::common::local_conf().set_mon_vals(m->config); + return crimson::common::local_conf().set_mon_vals(m->config); } std::vector<unsigned> Client::get_random_mons(unsigned n) const @@ -938,7 +932,7 @@ seastar::future<> Client::reopen_session(int rank) mons.push_back(rank); } else { const auto parallel = - ceph::common::local_conf().get_val<uint64_t>("mon_client_hunt_parallel"); + crimson::common::local_conf().get_val<uint64_t>("mon_client_hunt_parallel"); mons = get_random_mons(parallel); } pending_conns.reserve(mons.size()); @@ -951,7 +945,7 @@ seastar::future<> Client::reopen_session(int rank) // sharded-messenger compatible mode assumes all connections running // in one shard. ceph_assert((*xconn)->shard_id() == seastar::engine().cpu_id()); - ceph::net::ConnectionRef conn = xconn->release(); + crimson::net::ConnectionRef conn = xconn->release(); auto& mc = pending_conns.emplace_back( std::make_unique<Connection>(auth_registry, conn, &keyring)); if (conn->get_peer_addr().is_msgr2()) { @@ -1077,4 +1071,4 @@ seastar::future<> Client::renew_subs() }); } -} // namespace ceph::mon +} // namespace crimson::mon diff --git a/src/crimson/mon/MonClient.h b/src/crimson/mon/MonClient.h index c84f0adb5ed..3868954c143 100644 --- a/src/crimson/mon/MonClient.h +++ b/src/crimson/mon/MonClient.h @@ -24,7 +24,7 @@ #include "mon/MonSub.h" template<typename Message> using Ref = boost::intrusive_ptr<Message>; -namespace ceph::net { +namespace crimson::net { class Messenger; } @@ -37,13 +37,13 @@ struct MMonCommandAck; struct MLogAck; struct MConfig; -namespace ceph::mon { +namespace crimson::mon { class Connection; -class Client : public ceph::net::Dispatcher, - public ceph::auth::AuthClient, - public ceph::auth::AuthServer +class Client : public crimson::net::Dispatcher, + public crimson::auth::AuthClient, + public crimson::auth::AuthServer { EntityName entity_name; KeyRing keyring; @@ -55,7 +55,7 @@ class Client : public ceph::net::Dispatcher, seastar::timer<seastar::lowres_clock> timer; seastar::gate tick_gate; - ceph::net::Messenger& msgr; + crimson::net::Messenger& msgr; // commands using get_version_t = seastar::future<version_t, version_t>; @@ -71,7 +71,7 @@ class Client : public ceph::net::Dispatcher, MonSub sub; public: - Client(ceph::net::Messenger&, ceph::common::AuthHandler&); + Client(crimson::net::Messenger&, crimson::common::AuthHandler&); Client(Client&&); ~Client(); seastar::future<> start(); @@ -99,7 +99,7 @@ private: const std::vector<uint32_t>& preferred_modes) final; AuthAuthorizeHandler* get_auth_authorize_handler(int peer_type, int auth_method) final; - int handle_auth_request(ceph::net::ConnectionRef conn, + int handle_auth_request(crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, bool more, uint32_t auth_method, @@ -108,27 +108,27 @@ private: CephContext cct; // for auth_registry AuthRegistry auth_registry; - ceph::common::AuthHandler& auth_handler; + crimson::common::AuthHandler& auth_handler; // AuthClient methods - ceph::auth::AuthClient::auth_request_t - get_auth_request(ceph::net::ConnectionRef conn, + crimson::auth::AuthClient::auth_request_t + get_auth_request(crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta) final; // Handle server's request to continue the handshake - ceph::bufferlist handle_auth_reply_more(ceph::net::ConnectionRef conn, + ceph::bufferlist handle_auth_reply_more(crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, const bufferlist& bl) final; // Handle server's indication that authentication succeeded - int handle_auth_done(ceph::net::ConnectionRef conn, + int handle_auth_done(crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, uint64_t global_id, uint32_t con_mode, const bufferlist& bl) final; // Handle server's indication that the previous auth attempt failed - int handle_auth_bad_method(ceph::net::ConnectionRef conn, + int handle_auth_bad_method(crimson::net::ConnectionRef conn, AuthConnectionMetaRef auth_meta, uint32_t old_auth_method, int result, @@ -138,13 +138,13 @@ private: private: void tick(); - seastar::future<> ms_dispatch(ceph::net::Connection* conn, + seastar::future<> ms_dispatch(crimson::net::Connection* conn, MessageRef m) override; - seastar::future<> ms_handle_reset(ceph::net::ConnectionRef conn) override; + seastar::future<> ms_handle_reset(crimson::net::ConnectionRef conn) override; - seastar::future<> handle_monmap(ceph::net::Connection* conn, + seastar::future<> handle_monmap(crimson::net::Connection* conn, Ref<MMonMap> m); - seastar::future<> handle_auth_reply(ceph::net::Connection* conn, + seastar::future<> handle_auth_reply(crimson::net::Connection* conn, Ref<MAuthReply> m); seastar::future<> handle_subscribe_ack(Ref<MMonSubscribeAck> m); seastar::future<> handle_get_version_reply(Ref<MMonGetVersionReply> m); @@ -162,4 +162,4 @@ private: seastar::future<> _add_conn(unsigned rank, uint64_t global_id); }; -} // namespace ceph::mon +} // namespace crimson::mon diff --git a/src/crimson/net/Config.h b/src/crimson/net/Config.h index 6b040a19812..229b68913db 100644 --- a/src/crimson/net/Config.h +++ b/src/crimson/net/Config.h @@ -7,7 +7,7 @@ #include "include/msgr.h" #include <chrono> -namespace ceph::net { +namespace crimson::net { using namespace std::literals::chrono_literals; diff --git a/src/crimson/net/Connection.h b/src/crimson/net/Connection.h index 556ad6ee442..f2d8ad74161 100644 --- a/src/crimson/net/Connection.h +++ b/src/crimson/net/Connection.h @@ -20,7 +20,7 @@ #include "Fwd.h" -namespace ceph::net { +namespace crimson::net { #ifdef UNIT_TESTS_BUILT class Interceptor; @@ -153,4 +153,4 @@ inline ostream& operator<<(ostream& out, const Connection& conn) { return out; } -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/Dispatcher.h b/src/crimson/net/Dispatcher.h index 134a91ba525..304719b811d 100644 --- a/src/crimson/net/Dispatcher.h +++ b/src/crimson/net/Dispatcher.h @@ -21,7 +21,7 @@ class AuthAuthorizer; -namespace ceph::net { +namespace crimson::net { class Dispatcher { public: @@ -60,4 +60,4 @@ class Dispatcher { } }; -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/Errors.cc b/src/crimson/net/Errors.cc index 57d793250ec..bc92bc75d36 100644 --- a/src/crimson/net/Errors.cc +++ b/src/crimson/net/Errors.cc @@ -14,13 +14,13 @@ #include "Errors.h" -namespace ceph::net { +namespace crimson::net { const std::error_category& net_category() { struct category : public std::error_category { const char* name() const noexcept override { - return "ceph::net"; + return "crimson::net"; } std::string message(int ev) const override { @@ -138,4 +138,4 @@ const std::error_category& net_category() return instance; } -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/Errors.h b/src/crimson/net/Errors.h index 596a0d5f2de..0957517b008 100644 --- a/src/crimson/net/Errors.h +++ b/src/crimson/net/Errors.h @@ -16,7 +16,7 @@ #include <system_error> -namespace ceph::net { +namespace crimson::net { /// net error codes enum class error { @@ -48,12 +48,12 @@ inline std::error_condition make_error_condition(error e) return {static_cast<int>(e), net_category()}; } -} // namespace ceph::net +} // namespace crimson::net namespace std { /// enables implicit conversion to std::error_condition template <> -struct is_error_condition_enum<ceph::net::error> : public true_type {}; +struct is_error_condition_enum<crimson::net::error> : public true_type {}; } // namespace std diff --git a/src/crimson/net/Fwd.h b/src/crimson/net/Fwd.h index cdc758ef2e2..078b61e8b44 100644 --- a/src/crimson/net/Fwd.h +++ b/src/crimson/net/Fwd.h @@ -26,7 +26,7 @@ using auth_proto_t = int; class AuthConnectionMeta; using AuthConnectionMetaRef = seastar::lw_shared_ptr<AuthConnectionMeta>; -namespace ceph::net { +namespace crimson::net { using msgr_tag_t = uint8_t; using stop_t = seastar::stop_iteration; @@ -58,4 +58,4 @@ seastar::future<T*> create_sharded(Args... args) { }); } -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/Interceptor.h b/src/crimson/net/Interceptor.h index 6bea23a3962..858be0a38e0 100644 --- a/src/crimson/net/Interceptor.h +++ b/src/crimson/net/Interceptor.h @@ -10,7 +10,7 @@ #include "Fwd.h" #include "msg/async/frames_v2.h" -namespace ceph::net { +namespace crimson::net { enum class custom_bp_t : uint8_t { BANNER_WRITE = 0, @@ -162,4 +162,4 @@ struct Interceptor { virtual bp_action_t intercept(Connection& conn, Breakpoint bp) = 0; }; -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/Messenger.cc b/src/crimson/net/Messenger.cc index 7f8665ef4a8..6992c45e95b 100644 --- a/src/crimson/net/Messenger.cc +++ b/src/crimson/net/Messenger.cc @@ -4,7 +4,7 @@ #include "Messenger.h" #include "SocketMessenger.h" -namespace ceph::net { +namespace crimson::net { seastar::future<Messenger*> Messenger::create(const entity_name_t& name, @@ -18,4 +18,4 @@ Messenger::create(const entity_name_t& name, }); } -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/Messenger.h b/src/crimson/net/Messenger.h index eeceed2ef9c..f0004365fd7 100644 --- a/src/crimson/net/Messenger.h +++ b/src/crimson/net/Messenger.h @@ -23,26 +23,26 @@ class AuthAuthorizer; -namespace ceph::auth { +namespace crimson::auth { class AuthClient; class AuthServer; } -namespace ceph::net { +namespace crimson::net { #ifdef UNIT_TESTS_BUILT class Interceptor; #endif -using Throttle = ceph::thread::Throttle; +using Throttle = crimson::thread::Throttle; using SocketPolicy = ceph::net::Policy<Throttle>; class Messenger { entity_name_t my_name; entity_addrvec_t my_addrs; uint32_t crc_flags = 0; - ceph::auth::AuthClient* auth_client = nullptr; - ceph::auth::AuthServer* auth_server = nullptr; + crimson::auth::AuthClient* auth_client = nullptr; + crimson::auth::AuthServer* auth_server = nullptr; bool require_authorizer = true; public: @@ -97,12 +97,12 @@ public: crc_flags |= MSG_CRC_HEADER; } - ceph::auth::AuthClient* get_auth_client() const { return auth_client; } - void set_auth_client(ceph::auth::AuthClient *ac) { + crimson::auth::AuthClient* get_auth_client() const { return auth_client; } + void set_auth_client(crimson::auth::AuthClient *ac) { auth_client = ac; } - ceph::auth::AuthServer* get_auth_server() const { return auth_server; } - void set_auth_server(ceph::auth::AuthServer *as) { + crimson::auth::AuthServer* get_auth_server() const { return auth_server; } + void set_auth_server(crimson::auth::AuthServer *as) { auth_server = as; } @@ -145,4 +145,4 @@ inline ostream& operator<<(ostream& out, const Messenger& msgr) { return out; } -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/Protocol.cc b/src/crimson/net/Protocol.cc index 1fad3a499d3..10e232a7eca 100644 --- a/src/crimson/net/Protocol.cc +++ b/src/crimson/net/Protocol.cc @@ -13,11 +13,11 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_ms); + return crimson::get_logger(ceph_subsys_ms); } } -namespace ceph::net { +namespace crimson::net { Protocol::Protocol(proto_t type, Dispatcher& dispatcher, @@ -306,4 +306,4 @@ void Protocol::write_event() } } -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/Protocol.h b/src/crimson/net/Protocol.h index 688b5e3d607..ca1b08896e1 100644 --- a/src/crimson/net/Protocol.h +++ b/src/crimson/net/Protocol.h @@ -9,7 +9,7 @@ #include "Fwd.h" #include "SocketConnection.h" -namespace ceph::net { +namespace crimson::net { class Protocol { public: @@ -149,4 +149,4 @@ class Protocol { void write_event(); }; -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/ProtocolV1.cc b/src/crimson/net/ProtocolV1.cc index 88e09b2c31a..ac8f65402ab 100644 --- a/src/crimson/net/ProtocolV1.cc +++ b/src/crimson/net/ProtocolV1.cc @@ -51,7 +51,7 @@ std::ostream& operator<<(std::ostream& out, const ceph_msg_connect_reply& r) namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_ms); + return crimson::get_logger(ceph_subsys_ms); } template <typename T> @@ -78,7 +78,7 @@ void validate_banner(bufferlist::const_iterator& p) auto len = p.get_ptr_and_advance(remaining, &buf); if (!std::equal(buf, buf + len, b)) { throw std::system_error( - make_error_code(ceph::net::error::bad_connect_banner)); + make_error_code(crimson::net::error::bad_connect_banner)); } b += len; } @@ -112,7 +112,7 @@ uint32_t get_proto_version(entity_type_t peer_type, bool connect) } void discard_up_to(std::deque<MessageRef>* queue, - ceph::net::seq_num_t seq) + crimson::net::seq_num_t seq) { while (!queue->empty() && queue->front()->get_seq() < seq) { @@ -122,7 +122,7 @@ void discard_up_to(std::deque<MessageRef>* queue, } // namespace anonymous -namespace ceph::net { +namespace crimson::net { ProtocolV1::ProtocolV1(Dispatcher& dispatcher, SocketConnection& conn, @@ -345,7 +345,7 @@ void ProtocolV1::start_connect(const entity_addr_t& _peer_addr, logger().error("{} my peer_addr {} doesn't match what peer advertized {}", conn, conn.peer_addr, saddr); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } conn.set_ephemeral_port(caddr.get_port(), SocketConnection::side_t::connector); @@ -353,7 +353,7 @@ void ProtocolV1::start_connect(const entity_addr_t& _peer_addr, logger().warn("{} peer sent a v2 address for me: {}", conn, caddr); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } caddr.set_type(entity_addr_t::TYPE_LEGACY); return messenger.learned_addr(caddr, conn); @@ -540,7 +540,7 @@ seastar::future<stop_t> ProtocolV1::repeat_handle_connect() logger().error("{} we don't know how to reconnect to peer {}", conn, conn.target_addr); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } return socket->read(h.connect.authorizer_len); }).then([this] (bufferlist authorizer) { @@ -643,7 +643,7 @@ void ProtocolV1::start_accept(SocketFRef&& sock, " which should be v1 and the same host with {}.", conn, addr, conn.peer_addr); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } conn.peer_addr = addr; conn.target_addr = conn.peer_addr; @@ -963,4 +963,4 @@ seastar::future<> ProtocolV1::fault() return seastar::now(); } -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/ProtocolV1.h b/src/crimson/net/ProtocolV1.h index 834016e5ec7..b1b1dbf1918 100644 --- a/src/crimson/net/ProtocolV1.h +++ b/src/crimson/net/ProtocolV1.h @@ -8,7 +8,7 @@ class AuthAuthorizer; class AuthSessionHandler; -namespace ceph::net { +namespace crimson::net { class ProtocolV1 final : public Protocol { public: @@ -85,7 +85,7 @@ class ProtocolV1 final : public Protocol { private: // connecting void reset_session(); - seastar::future<stop_t> handle_connect_reply(ceph::net::msgr_tag_t tag); + seastar::future<stop_t> handle_connect_reply(crimson::net::msgr_tag_t tag); seastar::future<stop_t> repeat_connect(); ceph::bufferlist get_auth_payload(); @@ -125,4 +125,4 @@ class ProtocolV1 final : public Protocol { seastar::future<> fault(); }; -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index d10db3f7f69..2de2dd75e98 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -55,25 +55,25 @@ namespace { // - integrity checks; // - etc. seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_ms); + return crimson::get_logger(ceph_subsys_ms); } void abort_in_fault() { - throw std::system_error(make_error_code(ceph::net::error::negotiation_failure)); + throw std::system_error(make_error_code(crimson::net::error::negotiation_failure)); } void abort_protocol() { - throw std::system_error(make_error_code(ceph::net::error::protocol_aborted)); + throw std::system_error(make_error_code(crimson::net::error::protocol_aborted)); } -void abort_in_close(ceph::net::ProtocolV2& proto) { +void abort_in_close(crimson::net::ProtocolV2& proto) { (void) proto.close(); abort_protocol(); } inline void expect_tag(const Tag& expected, const Tag& actual, - ceph::net::SocketConnection& conn, + crimson::net::SocketConnection& conn, const char *where) { if (actual != expected) { logger().warn("{} {} received wrong tag: {}, expected {}", @@ -85,7 +85,7 @@ inline void expect_tag(const Tag& expected, } inline void unexpected_tag(const Tag& unexpected, - ceph::net::SocketConnection& conn, + crimson::net::SocketConnection& conn, const char *where) { logger().warn("{} {} received unexpected tag: {}", conn, where, static_cast<uint32_t>(unexpected)); @@ -125,7 +125,7 @@ inline ostream& operator<<( } } -namespace ceph::net { +namespace crimson::net { #ifdef UNIT_TESTS_BUILT void intercept(Breakpoint bp, bp_type_t type, @@ -696,7 +696,7 @@ seastar::future<> ProtocolV2::client_auth(std::vector<uint32_t> &allowed_methods return write_frame(frame).then([this] { return handle_auth_reply(); }); - } catch (const ceph::auth::error& e) { + } catch (const crimson::auth::error& e) { logger().error("{} get_initial_auth_request returned {}", conn, e); dispatch_reset(); abort_in_close(*this); @@ -780,7 +780,7 @@ ProtocolV2::client_connect() logger().warn("{} peer identifies as {}, does not include {}", conn, server_ident.addrs(), conn.target_addr); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } server_cookie = server_ident.cookie(); @@ -790,7 +790,7 @@ ProtocolV2::client_connect() logger().warn("{} peer advertises as {}, does not match {}", conn, server_ident.addrs(), conn.peer_addr); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } conn.set_peer_id(server_ident.gid()); conn.set_features(server_ident.supported_features() & @@ -954,7 +954,7 @@ void ProtocolV2::execute_connecting() logger().warn("{} peer sent a legacy address for me: {}", conn, _my_addr_from_peer); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } _my_addr_from_peer.set_type(entity_addr_t::TYPE_MSGR2); return messenger.learned_addr(_my_addr_from_peer, conn); @@ -1280,13 +1280,13 @@ ProtocolV2::server_connect() client_ident.addrs().front() == entity_addr_t()) { logger().warn("{} oops, client_ident.addrs() is empty", conn); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } if (!messenger.get_myaddrs().contains(client_ident.target_addr())) { logger().warn("{} peer is trying to reach {} which is not us ({})", conn, client_ident.target_addr(), messenger.get_myaddrs()); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } // TODO: change peer_addr to entity_addrvec_t entity_addr_t paddr = client_ident.addrs().front(); @@ -1297,7 +1297,7 @@ ProtocolV2::server_connect() logger().warn("{} peer's address {} is not v2 or not the same host with {}", conn, paddr, conn.target_addr); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } conn.peer_addr = paddr; logger().debug("{} UPDATE: peer_addr={}", conn, conn.peer_addr); @@ -1306,7 +1306,7 @@ ProtocolV2::server_connect() logger().warn("{} we don't know how to reconnect to peer {}", conn, conn.target_addr); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } conn.set_peer_id(client_ident.gid()); @@ -1421,7 +1421,7 @@ ProtocolV2::server_reconnect() } else { logger().warn("{} peer's address {} is not v2", conn, paddr); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } if (conn.peer_addr == entity_addr_t()) { conn.peer_addr = paddr; @@ -1430,7 +1430,7 @@ ProtocolV2::server_reconnect() " reconnect failed", conn, paddr, conn.peer_addr); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } peer_global_seq = reconnect.global_seq(); @@ -1565,7 +1565,7 @@ void ProtocolV2::execute_accepting() logger().warn("{} my_addr_from_peer {} port/nonce doesn't match myaddr {}", conn, _my_addr_from_peer, messenger.get_myaddr()); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } return messenger.learned_addr(_my_addr_from_peer, conn); }).then([this] { @@ -2178,4 +2178,4 @@ void ProtocolV2::trigger_close() #endif } -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/ProtocolV2.h b/src/crimson/net/ProtocolV2.h index 7bba5d79a68..d3800bc821a 100644 --- a/src/crimson/net/ProtocolV2.h +++ b/src/crimson/net/ProtocolV2.h @@ -9,7 +9,7 @@ #include "msg/async/frames_v2.h" #include "msg/async/crypto_onwire.h" -namespace ceph::net { +namespace crimson::net { class ProtocolV2 final : public Protocol { public: @@ -208,4 +208,4 @@ class ProtocolV2 final : public Protocol { void execute_server_wait(); }; -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/Socket.cc b/src/crimson/net/Socket.cc index 62d73d4b52a..43affbbdf79 100644 --- a/src/crimson/net/Socket.cc +++ b/src/crimson/net/Socket.cc @@ -6,12 +6,12 @@ #include "crimson/common/log.h" #include "Errors.h" -namespace ceph::net { +namespace crimson::net { namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_ms); + return crimson::get_logger(ceph_subsys_ms); } // an input_stream consumer that reads buffer segments into a bufferlist up to @@ -145,7 +145,7 @@ seastar::future<> Socket::try_trap_pre(bp_action_t& trap) { break; case bp_action_t::FAULT: logger().info("[Test] got FAULT"); - throw std::system_error(make_error_code(ceph::net::error::negotiation_failure)); + throw std::system_error(make_error_code(crimson::net::error::negotiation_failure)); case bp_action_t::BLOCK: logger().info("[Test] got BLOCK"); return blocker->block(); @@ -192,4 +192,4 @@ void Socket::set_trap(bp_type_t type, bp_action_t action, socket_blocker* blocke } #endif -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/Socket.h b/src/crimson/net/Socket.h index b7463f1033f..ef734a84ac9 100644 --- a/src/crimson/net/Socket.h +++ b/src/crimson/net/Socket.h @@ -14,7 +14,7 @@ #include "Interceptor.h" #endif -namespace ceph::net { +namespace crimson::net { class Socket; using SocketFRef = seastar::foreign_ptr<std::unique_ptr<Socket>>; @@ -139,4 +139,4 @@ class Socket #endif }; -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index dcf7ea41974..f6dfc3eddc4 100644 --- a/src/crimson/net/SocketConnection.cc +++ b/src/crimson/net/SocketConnection.cc @@ -23,7 +23,7 @@ #include "Interceptor.h" #endif -using namespace ceph::net; +using namespace crimson::net; SocketConnection::SocketConnection(SocketMessenger& messenger, Dispatcher& dispatcher, @@ -46,7 +46,7 @@ SocketConnection::SocketConnection(SocketMessenger& messenger, SocketConnection::~SocketConnection() {} -ceph::net::Messenger* +crimson::net::Messenger* SocketConnection::get_messenger() const { return &messenger; } diff --git a/src/crimson/net/SocketConnection.h b/src/crimson/net/SocketConnection.h index 987d48b74f6..e436754c98d 100644 --- a/src/crimson/net/SocketConnection.h +++ b/src/crimson/net/SocketConnection.h @@ -21,7 +21,7 @@ #include "crimson/net/Socket.h" #include "crimson/thread/Throttle.h" -namespace ceph::net { +namespace crimson::net { class Dispatcher; class Protocol; @@ -47,7 +47,7 @@ class SocketConnection : public Connection { side = _side; } - ceph::net::Policy<ceph::thread::Throttle> policy; + ceph::net::Policy<crimson::thread::Throttle> policy; /// the seq num of the last transmitted message seq_num_t out_seq = 0; @@ -114,4 +114,4 @@ class SocketConnection : public Connection { friend class ProtocolV2; }; -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/net/SocketMessenger.cc b/src/crimson/net/SocketMessenger.cc index 9bcad634afd..e2cbaeece02 100644 --- a/src/crimson/net/SocketMessenger.cc +++ b/src/crimson/net/SocketMessenger.cc @@ -22,14 +22,14 @@ #include "Dispatcher.h" #include "Socket.h" -using namespace ceph::net; - namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_ms); + return crimson::get_logger(ceph_subsys_ms); } } +namespace crimson::net { + SocketMessenger::SocketMessenger(const entity_name_t& myname, const std::string& logic_name, uint32_t nonce, @@ -109,7 +109,7 @@ seastar::future<> SocketMessenger::start(Dispatcher *disp) { }); } -seastar::future<ceph::net::ConnectionXRef> +seastar::future<crimson::net::ConnectionXRef> SocketMessenger::connect(const entity_addr_t& peer_addr, const entity_type_t& peer_type) { // make sure we connect to a valid peer_addr @@ -195,7 +195,7 @@ seastar::future<> SocketMessenger::do_start(Dispatcher *disp) return seastar::now(); } -seastar::foreign_ptr<ceph::net::ConnectionRef> +seastar::foreign_ptr<crimson::net::ConnectionRef> SocketMessenger::do_connect(const entity_addr_t& peer_addr, const entity_type_t& peer_type) { if (auto found = lookup_conn(peer_addr); found) { @@ -243,7 +243,7 @@ seastar::future<> SocketMessenger::learned_addr(const entity_addr_t &peer_addr_f logger().warn("{} peer_addr_for_me {} type/family/IP doesn't match myaddr {}", conn, peer_addr_for_me, msgr.get_myaddr()); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } return seastar::now(); } @@ -266,13 +266,13 @@ seastar::future<> SocketMessenger::learned_addr(const entity_addr_t &peer_addr_f logger().warn("{} peer_addr_for_me {} type doesn't match myaddr {}", conn, peer_addr_for_me, msgr.get_myaddr()); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } if (msgr.get_myaddr().get_family() != peer_addr_for_me.get_family()) { logger().warn("{} peer_addr_for_me {} family doesn't match myaddr {}", conn, peer_addr_for_me, msgr.get_myaddr()); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } if (msgr.get_myaddr().is_blank_ip()) { entity_addr_t addr = peer_addr_for_me; @@ -287,7 +287,7 @@ seastar::future<> SocketMessenger::learned_addr(const entity_addr_t &peer_addr_f logger().warn("{} peer_addr_for_me {} IP doesn't match myaddr {}", conn, peer_addr_for_me, msgr.get_myaddr()); throw std::system_error( - make_error_code(ceph::net::error::bad_peer_address)); + make_error_code(crimson::net::error::bad_peer_address)); } else { return seastar::now(); } @@ -336,7 +336,7 @@ seastar::shard_id SocketMessenger::locate_shard(const entity_addr_t& addr) return seed % seastar::smp::count; } -ceph::net::SocketConnectionRef SocketMessenger::lookup_conn(const entity_addr_t& addr) +crimson::net::SocketConnectionRef SocketMessenger::lookup_conn(const entity_addr_t& addr) { if (auto found = connections.find(addr); found != connections.end()) { @@ -385,3 +385,5 @@ SocketMessenger::get_global_seq(uint32_t old) return ++msgr.global_seq; }); } + +} // namespace crimson::net diff --git a/src/crimson/net/SocketMessenger.h b/src/crimson/net/SocketMessenger.h index 82fa6c8625b..2eecc306859 100644 --- a/src/crimson/net/SocketMessenger.h +++ b/src/crimson/net/SocketMessenger.h @@ -25,7 +25,7 @@ #include "Messenger.h" #include "SocketConnection.h" -namespace ceph::net { +namespace crimson::net { class SocketMessenger final : public Messenger, public seastar::peering_sharded_service<SocketMessenger> { const int master_sid; @@ -127,4 +127,4 @@ class SocketMessenger final : public Messenger, public seastar::peering_sharded_ } }; -} // namespace ceph::net +} // namespace crimson::net diff --git a/src/crimson/os/cyan_collection.cc b/src/crimson/os/cyan_collection.cc index 775cc85e6da..206e902bb3a 100644 --- a/src/crimson/os/cyan_collection.cc +++ b/src/crimson/os/cyan_collection.cc @@ -2,7 +2,7 @@ #include "cyan_object.h" -namespace ceph::os +namespace crimson::os { Collection::Collection(const coll_t& c) @@ -13,7 +13,7 @@ Collection::~Collection() = default; Collection::ObjectRef Collection::create_object() const { - return new ceph::os::Object{}; + return new crimson::os::Object{}; } Collection::ObjectRef Collection::get_object(ghobject_t oid) diff --git a/src/crimson/os/cyan_collection.h b/src/crimson/os/cyan_collection.h index fdc07d8fe76..4dc9e45ebcf 100644 --- a/src/crimson/os/cyan_collection.h +++ b/src/crimson/os/cyan_collection.h @@ -13,7 +13,7 @@ #include "futurized_collection.h" -namespace ceph::os { +namespace crimson::os { class Object; /** diff --git a/src/crimson/os/cyan_object.cc b/src/crimson/os/cyan_object.cc index c809e8e0d91..4692e695cad 100644 --- a/src/crimson/os/cyan_object.cc +++ b/src/crimson/os/cyan_object.cc @@ -1,7 +1,7 @@ #include "cyan_object.h" #include "include/encoding.h" -namespace ceph::os { +namespace crimson::os { size_t Object::get_size() const { return data.length(); diff --git a/src/crimson/os/cyan_object.h b/src/crimson/os/cyan_object.h index f2327590954..993fb903b92 100644 --- a/src/crimson/os/cyan_object.h +++ b/src/crimson/os/cyan_object.h @@ -7,7 +7,7 @@ #include <boost/smart_ptr/intrusive_ref_counter.hpp> #include "include/buffer.h" -namespace ceph::os { +namespace crimson::os { struct Object : public boost::intrusive_ref_counter< Object, diff --git a/src/crimson/os/cyan_store.cc b/src/crimson/os/cyan_store.cc index 44d6bff32d4..60573ee1723 100644 --- a/src/crimson/os/cyan_store.cc +++ b/src/crimson/os/cyan_store.cc @@ -17,13 +17,13 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_filestore); + return crimson::get_logger(ceph_subsys_filestore); } } -using ceph::common::local_conf; +using crimson::common::local_conf; -namespace ceph::os { +namespace crimson::os { using ObjectRef = boost::intrusive_ptr<Object>; @@ -119,7 +119,7 @@ store_statfs_t CyanStore::stat() const { logger().debug("{}", __func__); store_statfs_t st; - st.total = ceph::common::local_conf().get_val<Option::size_t>("memstore_device_bytes"); + st.total = crimson::common::local_conf().get_val<Option::size_t>("memstore_device_bytes"); st.available = st.total - used_bytes; return st; } @@ -277,15 +277,15 @@ CyanStore::omap_get_values( } seastar::future<> CyanStore::do_transaction(CollectionRef ch, - Transaction&& t) + ceph::os::Transaction&& t) { + using ceph::os::Transaction; int r = 0; try { auto i = t.begin(); while (i.have_op()) { - Transaction::Op* op = i.decode_op(); r = 0; - switch (op->op) { + switch (auto op = i.decode_op(); op->op) { case Transaction::OP_NOP: break; case Transaction::OP_REMOVE: diff --git a/src/crimson/os/cyan_store.h b/src/crimson/os/cyan_store.h index 487a95d3611..83a816d7a7c 100644 --- a/src/crimson/os/cyan_store.h +++ b/src/crimson/os/cyan_store.h @@ -18,9 +18,11 @@ #include "futurized_store.h" namespace ceph::os { +class Transaction; +} +namespace crimson::os { class Collection; -class Transaction; class CyanStore final : public FuturizedStore { constexpr static unsigned MAX_KEYS_PER_OMAP_GET_CALL = 32; @@ -76,7 +78,7 @@ public: seastar::future<std::vector<coll_t>> list_collections() final; seastar::future<> do_transaction(CollectionRef ch, - Transaction&& txn) final; + ceph::os::Transaction&& txn) final; seastar::future<> write_meta(const std::string& key, const std::string& value) final; diff --git a/src/crimson/os/futurized_collection.h b/src/crimson/os/futurized_collection.h index ad72d17c021..2226a53aa1c 100644 --- a/src/crimson/os/futurized_collection.h +++ b/src/crimson/os/futurized_collection.h @@ -9,7 +9,7 @@ #include "osd/osd_types.h" -namespace ceph::os { +namespace crimson::os { class FuturizedCollection : public boost::intrusive_ref_counter<FuturizedCollection, diff --git a/src/crimson/os/futurized_store.cc b/src/crimson/os/futurized_store.cc index 49294b728bc..22d90b7554b 100644 --- a/src/crimson/os/futurized_store.cc +++ b/src/crimson/os/futurized_store.cc @@ -1,13 +1,14 @@ #include "futurized_store.h" #include "cyan_store.h" -namespace ceph::os { +namespace crimson::os { -std::unique_ptr<FuturizedStore> FuturizedStore::create(const std::string& type, - const std::string& data) +std::unique_ptr<FuturizedStore> +FuturizedStore::create(const std::string& type, + const std::string& data) { if (type == "memstore") { - return std::make_unique<ceph::os::CyanStore>(data); + return std::make_unique<crimson::os::CyanStore>(data); } else { ceph_abort_msgf("unsupported objectstore type: %s", type.c_str()); return {}; diff --git a/src/crimson/os/futurized_store.h b/src/crimson/os/futurized_store.h index 3ff9cb0f7a8..96415653bbf 100644 --- a/src/crimson/os/futurized_store.h +++ b/src/crimson/os/futurized_store.h @@ -16,14 +16,16 @@ #include "osd/osd_types.h" namespace ceph::os { +class Transaction; +} +namespace crimson::os { class FuturizedCollection; -class Transaction; class FuturizedStore { public: - // TODO: replace with the ceph::errorator concept + // TODO: replace with the crimson::errorator concept template <class ConcreteExceptionT> class Exception : public std::logic_error { public: @@ -103,7 +105,7 @@ public: virtual seastar::future<std::vector<coll_t>> list_collections() = 0; virtual seastar::future<> do_transaction(CollectionRef ch, - Transaction&& txn) = 0; + ceph::os::Transaction&& txn) = 0; virtual seastar::future<> write_meta(const std::string& key, const std::string& value) = 0; diff --git a/src/crimson/osd/acked_peers.h b/src/crimson/osd/acked_peers.h index 90199013b3a..9969766ea02 100644 --- a/src/crimson/osd/acked_peers.h +++ b/src/crimson/osd/acked_peers.h @@ -10,7 +10,7 @@ #include <vector> #endif -namespace ceph::osd { +namespace crimson::osd { struct peer_shard_t { pg_shard_t shard; eversion_t last_complete_ondisk; diff --git a/src/crimson/osd/chained_dispatchers.cc b/src/crimson/osd/chained_dispatchers.cc index d9db7fc2a0d..1bc40deb2a5 100644 --- a/src/crimson/osd/chained_dispatchers.cc +++ b/src/crimson/osd/chained_dispatchers.cc @@ -4,7 +4,7 @@ seastar::future<> -ChainedDispatchers::ms_dispatch(ceph::net::Connection* conn, +ChainedDispatchers::ms_dispatch(crimson::net::Connection* conn, MessageRef m) { return seastar::do_for_each(dispatchers, [conn, m](Dispatcher* dispatcher) { return dispatcher->ms_dispatch(conn, m); @@ -12,28 +12,28 @@ ChainedDispatchers::ms_dispatch(ceph::net::Connection* conn, } seastar::future<> -ChainedDispatchers::ms_handle_accept(ceph::net::ConnectionRef conn) { +ChainedDispatchers::ms_handle_accept(crimson::net::ConnectionRef conn) { return seastar::do_for_each(dispatchers, [conn](Dispatcher* dispatcher) { return dispatcher->ms_handle_accept(conn); }); } seastar::future<> -ChainedDispatchers::ms_handle_connect(ceph::net::ConnectionRef conn) { +ChainedDispatchers::ms_handle_connect(crimson::net::ConnectionRef conn) { return seastar::do_for_each(dispatchers, [conn](Dispatcher* dispatcher) { return dispatcher->ms_handle_connect(conn); }); } seastar::future<> -ChainedDispatchers::ms_handle_reset(ceph::net::ConnectionRef conn) { +ChainedDispatchers::ms_handle_reset(crimson::net::ConnectionRef conn) { return seastar::do_for_each(dispatchers, [conn](Dispatcher* dispatcher) { return dispatcher->ms_handle_reset(conn); }); } seastar::future<> -ChainedDispatchers::ms_handle_remote_reset(ceph::net::ConnectionRef conn) { +ChainedDispatchers::ms_handle_remote_reset(crimson::net::ConnectionRef conn) { return seastar::do_for_each(dispatchers, [conn](Dispatcher* dispatcher) { return dispatcher->ms_handle_remote_reset(conn); }); diff --git a/src/crimson/osd/chained_dispatchers.h b/src/crimson/osd/chained_dispatchers.h index 4eda44f8111..1748e03adac 100644 --- a/src/crimson/osd/chained_dispatchers.h +++ b/src/crimson/osd/chained_dispatchers.h @@ -13,7 +13,7 @@ // it requires changing the ms_ methods to return a bool. so as an intermediate // solution, we are using an observer dispatcher to notify all the interested // or unintersted parties. -class ChainedDispatchers : public ceph::net::Dispatcher { +class ChainedDispatchers : public crimson::net::Dispatcher { std::deque<Dispatcher*> dispatchers; public: void push_front(Dispatcher* dispatcher) { @@ -22,9 +22,9 @@ public: void push_back(Dispatcher* dispatcher) { dispatchers.push_back(dispatcher); } - seastar::future<> ms_dispatch(ceph::net::Connection* conn, MessageRef m) override; - seastar::future<> ms_handle_accept(ceph::net::ConnectionRef conn) override; - seastar::future<> ms_handle_connect(ceph::net::ConnectionRef conn) override; - seastar::future<> ms_handle_reset(ceph::net::ConnectionRef conn) override; - seastar::future<> ms_handle_remote_reset(ceph::net::ConnectionRef conn) override; + seastar::future<> ms_dispatch(crimson::net::Connection* conn, MessageRef m) override; + seastar::future<> ms_handle_accept(crimson::net::ConnectionRef conn) override; + seastar::future<> ms_handle_connect(crimson::net::ConnectionRef conn) override; + seastar::future<> ms_handle_reset(crimson::net::ConnectionRef conn) override; + seastar::future<> ms_handle_remote_reset(crimson::net::ConnectionRef conn) override; }; diff --git a/src/crimson/osd/ec_backend.cc b/src/crimson/osd/ec_backend.cc index cc136528278..5b4db3c1d9c 100644 --- a/src/crimson/osd/ec_backend.cc +++ b/src/crimson/osd/ec_backend.cc @@ -4,7 +4,7 @@ ECBackend::ECBackend(shard_id_t shard, ECBackend::CollectionRef coll, - ceph::osd::ShardServices& shard_services, + crimson::osd::ShardServices& shard_services, const ec_profile_t&, uint64_t) : PGBackend{shard, coll, &shard_services.get_store()} @@ -21,7 +21,7 @@ seastar::future<bufferlist> ECBackend::_read(const hobject_t& hoid, return seastar::make_ready_future<bufferlist>(); } -seastar::future<ceph::osd::acked_peers_t> +seastar::future<crimson::osd::acked_peers_t> ECBackend::_submit_transaction(std::set<pg_shard_t>&& pg_shards, const hobject_t& hoid, ceph::os::Transaction&& txn, @@ -30,5 +30,5 @@ ECBackend::_submit_transaction(std::set<pg_shard_t>&& pg_shards, eversion_t ver) { // todo - return seastar::make_ready_future<ceph::osd::acked_peers_t>(); + return seastar::make_ready_future<crimson::osd::acked_peers_t>(); } diff --git a/src/crimson/osd/ec_backend.h b/src/crimson/osd/ec_backend.h index 107c048217b..31c39e93f77 100644 --- a/src/crimson/osd/ec_backend.h +++ b/src/crimson/osd/ec_backend.h @@ -14,7 +14,7 @@ class ECBackend : public PGBackend public: ECBackend(shard_id_t shard, CollectionRef coll, - ceph::osd::ShardServices& shard_services, + crimson::osd::ShardServices& shard_services, const ec_profile_t& ec_profile, uint64_t stripe_width); private: @@ -22,7 +22,7 @@ private: uint64_t off, uint64_t len, uint32_t flags) override; - seastar::future<ceph::osd::acked_peers_t> + seastar::future<crimson::osd::acked_peers_t> _submit_transaction(std::set<pg_shard_t>&& pg_shards, const hobject_t& hoid, ceph::os::Transaction&& txn, @@ -30,5 +30,5 @@ private: epoch_t min_epoch, epoch_t max_epoch, eversion_t ver) final; CollectionRef coll; - ceph::os::FuturizedStore* store; + crimson::os::FuturizedStore* store; }; diff --git a/src/crimson/osd/exceptions.h b/src/crimson/osd/exceptions.h index 0d678e37294..38dce4e5e8d 100644 --- a/src/crimson/osd/exceptions.h +++ b/src/crimson/osd/exceptions.h @@ -6,7 +6,7 @@ #include <exception> #include <system_error> -namespace ceph::osd { +namespace crimson::osd { class error : private std::system_error { public: error(const std::errc ec) @@ -59,4 +59,4 @@ struct input_output_error : public error { input_output_error() : error(std::errc::io_error) {} }; -} // namespace ceph::osd +} // namespace crimson::osd diff --git a/src/crimson/osd/heartbeat.cc b/src/crimson/osd/heartbeat.cc index b778c08dd26..e1a1738a2f3 100644 --- a/src/crimson/osd/heartbeat.cc +++ b/src/crimson/osd/heartbeat.cc @@ -1,3 +1,6 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + #include "heartbeat.h" #include <boost/range/join.hpp> @@ -13,18 +16,18 @@ #include "osd/OSDMap.h" -using ceph::common::local_conf; +using crimson::common::local_conf; namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } -Heartbeat::Heartbeat(const ceph::osd::ShardServices& service, - ceph::mon::Client& monc, - ceph::net::Messenger& front_msgr, - ceph::net::Messenger& back_msgr) +Heartbeat::Heartbeat(const crimson::osd::ShardServices& service, + crimson::mon::Client& monc, + crimson::net::Messenger& front_msgr, + crimson::net::Messenger& back_msgr) : service{service}, monc{monc}, front_msgr{front_msgr}, @@ -42,7 +45,7 @@ seastar::future<> Heartbeat::start(entity_addrvec_t front_addrs, addr.set_port(0); } - using ceph::net::SocketPolicy; + using crimson::net::SocketPolicy; front_msgr.set_policy(entity_name_t::TYPE_OSD, SocketPolicy::stateless_server(0)); back_msgr.set_policy(entity_name_t::TYPE_OSD, @@ -56,7 +59,7 @@ seastar::future<> Heartbeat::start(entity_addrvec_t front_addrs, } seastar::future<> -Heartbeat::start_messenger(ceph::net::Messenger& msgr, +Heartbeat::start_messenger(crimson::net::Messenger& msgr, const entity_addrvec_t& addrs) { return msgr.try_bind(addrs, @@ -215,7 +218,7 @@ seastar::future<> Heartbeat::remove_peer(osd_id_t peer) }); } -seastar::future<> Heartbeat::ms_dispatch(ceph::net::Connection* conn, +seastar::future<> Heartbeat::ms_dispatch(crimson::net::Connection* conn, MessageRef m) { switch (m->get_type()) { @@ -226,7 +229,7 @@ seastar::future<> Heartbeat::ms_dispatch(ceph::net::Connection* conn, } } -seastar::future<> Heartbeat::ms_handle_reset(ceph::net::ConnectionRef conn) +seastar::future<> Heartbeat::ms_handle_reset(crimson::net::ConnectionRef conn) { auto found = std::find_if(peers.begin(), peers.end(), [conn](const peers_map_t::value_type& peer) { @@ -243,7 +246,7 @@ seastar::future<> Heartbeat::ms_handle_reset(ceph::net::ConnectionRef conn) }); } -seastar::future<> Heartbeat::handle_osd_ping(ceph::net::Connection* conn, +seastar::future<> Heartbeat::handle_osd_ping(crimson::net::Connection* conn, Ref<MOSDPing> m) { switch (m->op) { @@ -258,7 +261,7 @@ seastar::future<> Heartbeat::handle_osd_ping(ceph::net::Connection* conn, } } -seastar::future<> Heartbeat::handle_ping(ceph::net::Connection* conn, +seastar::future<> Heartbeat::handle_ping(crimson::net::Connection* conn, Ref<MOSDPing> m) { auto min_message = static_cast<uint32_t>( @@ -276,7 +279,7 @@ seastar::future<> Heartbeat::handle_ping(ceph::net::Connection* conn, return conn->send(reply); } -seastar::future<> Heartbeat::handle_reply(ceph::net::Connection* conn, +seastar::future<> Heartbeat::handle_reply(crimson::net::Connection* conn, Ref<MOSDPing> m) { const osd_id_t from = m->get_source().num(); @@ -337,8 +340,8 @@ seastar::future<> Heartbeat::send_heartbeats() const utime_t sent_stamp{now}; [[maybe_unused]] auto [reply, added] = info.ping_history.emplace(sent_stamp, reply_t{deadline, 0}); - std::vector<ceph::net::ConnectionRef> conns{info.con_front, - info.con_back}; + std::vector<crimson::net::ConnectionRef> conns{info.con_front, + info.con_back}; return seastar::parallel_for_each(std::move(conns), [sent_stamp, mnow, &reply=reply->second, this] (auto con) { if (con) { diff --git a/src/crimson/osd/heartbeat.h b/src/crimson/osd/heartbeat.h index 96a67cc8363..d3978da89f2 100644 --- a/src/crimson/osd/heartbeat.h +++ b/src/crimson/osd/heartbeat.h @@ -11,24 +11,24 @@ class MOSDPing; -namespace ceph::osd { +namespace crimson::osd { class ShardServices; } -namespace ceph::mon { +namespace crimson::mon { class Client; } template<typename Message> using Ref = boost::intrusive_ptr<Message>; -class Heartbeat : public ceph::net::Dispatcher { +class Heartbeat : public crimson::net::Dispatcher { public: using osd_id_t = int; - Heartbeat(const ceph::osd::ShardServices& service, - ceph::mon::Client& monc, - ceph::net::Messenger& front_msgr, - ceph::net::Messenger& back_msgr); + Heartbeat(const crimson::osd::ShardServices& service, + crimson::mon::Client& monc, + crimson::net::Messenger& front_msgr, + crimson::net::Messenger& back_msgr); seastar::future<> start(entity_addrvec_t front, entity_addrvec_t back); @@ -47,16 +47,16 @@ public: void set_require_authorizer(bool); // Dispatcher methods - seastar::future<> ms_dispatch(ceph::net::Connection* conn, + seastar::future<> ms_dispatch(crimson::net::Connection* conn, MessageRef m) override; - seastar::future<> ms_handle_reset(ceph::net::ConnectionRef conn) override; + seastar::future<> ms_handle_reset(crimson::net::ConnectionRef conn) override; private: - seastar::future<> handle_osd_ping(ceph::net::Connection* conn, + seastar::future<> handle_osd_ping(crimson::net::Connection* conn, Ref<MOSDPing> m); - seastar::future<> handle_ping(ceph::net::Connection* conn, + seastar::future<> handle_ping(crimson::net::Connection* conn, Ref<MOSDPing> m); - seastar::future<> handle_reply(ceph::net::Connection* conn, + seastar::future<> handle_reply(crimson::net::Connection* conn, Ref<MOSDPing> m); seastar::future<> handle_you_died(); @@ -69,13 +69,13 @@ private: /// add enough reporters for fast failure detection seastar::future<> add_reporter_peers(int whoami); - seastar::future<> start_messenger(ceph::net::Messenger& msgr, + seastar::future<> start_messenger(crimson::net::Messenger& msgr, const entity_addrvec_t& addrs); private: - const ceph::osd::ShardServices& service; - ceph::mon::Client& monc; - ceph::net::Messenger& front_msgr; - ceph::net::Messenger& back_msgr; + const crimson::osd::ShardServices& service; + crimson::mon::Client& monc; + crimson::net::Messenger& front_msgr; + crimson::net::Messenger& back_msgr; seastar::timer<seastar::lowres_clock> timer; // use real_clock so it can be converted to utime_t @@ -88,9 +88,9 @@ private: }; struct PeerInfo { /// peer connection (front) - ceph::net::ConnectionRef con_front; + crimson::net::ConnectionRef con_front; /// peer connection (back) - ceph::net::ConnectionRef con_back; + crimson::net::ConnectionRef con_back; /// time we sent our first ping request clock::time_point first_tx; /// last time we sent a ping request diff --git a/src/crimson/osd/main.cc b/src/crimson/osd/main.cc index 3c0a6fb0126..e8584bdbe34 100644 --- a/src/crimson/osd/main.cc +++ b/src/crimson/osd/main.cc @@ -20,7 +20,7 @@ #include "osd.h" -using config_t = ceph::common::ConfigProxy; +using config_t = crimson::common::ConfigProxy; namespace fs = seastar::compat::filesystem; void usage(const char* prog) { @@ -76,7 +76,7 @@ auto partition_args(seastar::app_template& app, char** argv_begin, char** argv_e return make_pair(std::move(ceph_args), std::move(app_args)); } -using ceph::common::local_conf; +using crimson::common::local_conf; seastar::future<> make_keyring() { @@ -128,11 +128,11 @@ int main(int argc, char* argv[]) CEPH_ENTITY_TYPE_OSD, &cluster_name, &conf_file_list); - seastar::sharded<ceph::osd::OSD> osd; - seastar::sharded<ceph::net::SocketMessenger> cluster_msgr, client_msgr; - seastar::sharded<ceph::net::SocketMessenger> hb_front_msgr, hb_back_msgr; - using ceph::common::sharded_conf; - using ceph::common::sharded_perf_coll; + seastar::sharded<crimson::osd::OSD> osd; + seastar::sharded<crimson::net::SocketMessenger> cluster_msgr, client_msgr; + seastar::sharded<crimson::net::SocketMessenger> hb_front_msgr, hb_back_msgr; + using crimson::common::sharded_conf; + using crimson::common::sharded_perf_coll; try { return app.run_deprecated(app_args.size(), const_cast<char**>(app_args.data()), [&] { auto& config = app.configuration(); @@ -169,10 +169,10 @@ int main(int argc, char* argv[]) } } osd.start_single(whoami, nonce, - reference_wrapper<ceph::net::Messenger>(cluster_msgr.local()), - reference_wrapper<ceph::net::Messenger>(client_msgr.local()), - reference_wrapper<ceph::net::Messenger>(hb_front_msgr.local()), - reference_wrapper<ceph::net::Messenger>(hb_back_msgr.local())).get(); + reference_wrapper<crimson::net::Messenger>(cluster_msgr.local()), + reference_wrapper<crimson::net::Messenger>(client_msgr.local()), + reference_wrapper<crimson::net::Messenger>(hb_front_msgr.local()), + reference_wrapper<crimson::net::Messenger>(hb_back_msgr.local())).get(); seastar::engine().at_exit([&] { return osd.stop(); }); @@ -190,14 +190,14 @@ int main(int argc, char* argv[]) if (config.count("mkfs")) { osd.invoke_on( 0, - &ceph::osd::OSD::mkfs, + &crimson::osd::OSD::mkfs, local_conf().get_val<uuid_d>("osd_uuid"), local_conf().get_val<uuid_d>("fsid")).get(); } if (config.count("mkkey") || config.count("mkfs")) { seastar::engine().exit(0); } else { - osd.invoke_on(0, &ceph::osd::OSD::start).get(); + osd.invoke_on(0, &crimson::osd::OSD::start).get(); } }); }); diff --git a/src/crimson/osd/objclass.cc b/src/crimson/osd/objclass.cc index c5d75d96314..bade26240c0 100644 --- a/src/crimson/osd/objclass.cc +++ b/src/crimson/osd/objclass.cc @@ -57,10 +57,10 @@ int cls_get_request_origin(cls_method_context_t hctx, entity_inst_t *origin) try { const auto& message = \ - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->get_message(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->get_message(); *origin = message.get_orig_source_inst(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -70,9 +70,9 @@ int cls_cxx_create(cls_method_context_t hctx, const bool exclusive) OSDOp op{CEPH_OSD_OP_CREATE}; op.op.flags = (exclusive ? CEPH_OSD_OP_FLAG_EXCL : 0); try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -83,9 +83,9 @@ int cls_cxx_remove(cls_method_context_t hctx) // we're blocking here which presumes execution in Seastar's thread. try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -96,8 +96,8 @@ int cls_cxx_stat(cls_method_context_t hctx, uint64_t *size, time_t *mtime) // we're blocking here which presumes execution in Seastar's thread. try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); - } catch (ceph::osd::error& e) { + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + } catch (crimson::osd::error& e) { return -e.code().value(); } @@ -137,8 +137,8 @@ int cls_cxx_read2(cls_method_context_t hctx, op.op.extent.length = len; op.op.flags = op_flags; try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); - } catch (ceph::osd::error& e) { + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + } catch (crimson::osd::error& e) { return -e.code().value(); } outbl->claim(op.outdata); @@ -157,9 +157,9 @@ int cls_cxx_write2(cls_method_context_t hctx, op.op.flags = op_flags; op.indata = *inbl; try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -171,9 +171,9 @@ int cls_cxx_write_full(cls_method_context_t hctx, bufferlist * const inbl) op.op.extent.length = inbl->length(); op.indata = *inbl; try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -188,9 +188,9 @@ int cls_cxx_replace(cls_method_context_t hctx, top.op.extent.offset = 0; top.op.extent.length = 0; try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(top).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(top).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -202,9 +202,9 @@ int cls_cxx_replace(cls_method_context_t hctx, wop.indata = *inbl; try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(wop).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(wop).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -216,9 +216,9 @@ int cls_cxx_truncate(cls_method_context_t hctx, int ofs) op.op.extent.offset = ofs; op.op.extent.length = 0; try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -229,9 +229,9 @@ int cls_cxx_write_zero(cls_method_context_t hctx, int ofs, int len) op.op.extent.offset = ofs; op.op.extent.length = len; try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -244,10 +244,10 @@ int cls_cxx_getxattr(cls_method_context_t hctx, op.op.xattr.name_len = strlen(name); op.indata.append(name, op.op.xattr.name_len); try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); outbl->claim(op.outdata); return outbl->length(); - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -268,9 +268,9 @@ int cls_cxx_setxattr(cls_method_context_t hctx, op.indata.append(name, op.op.xattr.name_len); op.indata.append(*inbl); try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -280,9 +280,9 @@ int cls_cxx_snap_revert(cls_method_context_t hctx, snapid_t snapid) OSDOp op{op = CEPH_OSD_OP_ROLLBACK}; op.op.snap.snapid = snapid; try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -304,8 +304,8 @@ int cls_cxx_map_get_keys(cls_method_context_t hctx, encode(start_obj, op.indata); encode(max_to_get, op.indata); try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); - } catch (ceph::osd::error& e) { + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + } catch (crimson::osd::error& e) { return -e.code().value(); } try { @@ -330,8 +330,8 @@ int cls_cxx_map_get_vals(cls_method_context_t hctx, encode(max_to_get, op.indata); encode(filter_prefix, op.indata); try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); - } catch (ceph::osd::error& e) { + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + } catch (crimson::osd::error& e) { return -e.code().value(); } try { @@ -359,8 +359,8 @@ int cls_cxx_map_get_val(cls_method_context_t hctx, encode(k, op.indata); } try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); - } catch (ceph::osd::error& e) { + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + } catch (crimson::osd::error& e) { return -e.code().value(); } std::map<std::string, ceph::bufferlist> m; @@ -390,9 +390,9 @@ int cls_cxx_map_set_val(cls_method_context_t hctx, } try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -404,9 +404,9 @@ int cls_cxx_map_set_vals(cls_method_context_t hctx, encode(*map, op.indata); try { - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->execute_osd_op(op).get(); return 0; - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } @@ -459,9 +459,9 @@ uint64_t cls_get_client_features(cls_method_context_t hctx) { try { const auto& message = \ - reinterpret_cast<ceph::osd::OpsExecuter*>(hctx)->get_message(); + reinterpret_cast<crimson::osd::OpsExecuter*>(hctx)->get_message(); return message.get_features(); - } catch (ceph::osd::error& e) { + } catch (crimson::osd::error& e) { return -e.code().value(); } } diff --git a/src/crimson/osd/ops_executer.cc b/src/crimson/osd/ops_executer.cc index 13f6f086c4e..0e527854e51 100644 --- a/src/crimson/osd/ops_executer.cc +++ b/src/crimson/osd/ops_executer.cc @@ -20,11 +20,11 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } -namespace ceph::osd { +namespace crimson::osd { seastar::future<> OpsExecuter::do_op_call(OSDOp& osd_op) { @@ -37,7 +37,7 @@ seastar::future<> OpsExecuter::do_op_call(OSDOp& osd_op) bp.copy(osd_op.op.cls.indata_len, indata); } catch (buffer::error&) { logger().warn("call unable to decode class + method + indata"); - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } // NOTE: opening a class can actually result in dlopen(), and thus @@ -48,23 +48,23 @@ seastar::future<> OpsExecuter::do_op_call(OSDOp& osd_op) if (r) { logger().warn("class {} open got {}", cname, cpp_strerror(r)); if (r == -ENOENT) { - throw ceph::osd::operation_not_supported{}; + throw crimson::osd::operation_not_supported{}; } else if (r == -EPERM) { // propagate permission errors - throw ceph::osd::permission_denied{}; + throw crimson::osd::permission_denied{}; } - throw ceph::osd::input_output_error{}; + throw crimson::osd::input_output_error{}; } ClassHandler::ClassMethod* method = cls->get_method(mname); if (!method) { logger().warn("call method {}.{} does not exist", cname, mname); - throw ceph::osd::operation_not_supported{}; + throw crimson::osd::operation_not_supported{}; } const auto flags = method->get_flags(); if (!os->exists && (flags & CLS_METHOD_WR) == 0) { - throw ceph::osd::object_not_found{}; + throw crimson::osd::object_not_found{}; } #if 0 @@ -82,11 +82,11 @@ seastar::future<> OpsExecuter::do_op_call(OSDOp& osd_op) indata, outdata); if (num_read > prev_rd && !(flags & CLS_METHOD_RD)) { logger().error("method tried to read object but is not marked RD"); - throw ceph::osd::input_output_error{}; + throw crimson::osd::input_output_error{}; } if (num_write > prev_wr && !(flags & CLS_METHOD_WR)) { logger().error("method tried to update object but is not marked WR"); - throw ceph::osd::input_output_error{}; + throw crimson::osd::input_output_error{}; } // for write calls we never return data expect errors. For details refer @@ -97,7 +97,7 @@ seastar::future<> OpsExecuter::do_op_call(OSDOp& osd_op) osd_op.outdata.claim_append(outdata); } if (ret < 0) { - throw ceph::osd::make_error(ret); + throw crimson::osd::make_error(ret); } }); } @@ -113,7 +113,7 @@ static inline std::unique_ptr<const PGLSFilter> get_pgls_filter( } else { std::size_t dot = type.find("."); if (dot == type.npos || dot == 0 || dot == type.size() - 1) { - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } const std::string class_name = type.substr(0, dot); @@ -124,9 +124,9 @@ static inline std::unique_ptr<const PGLSFilter> get_pgls_filter( logger().warn("can't open class {}: {}", class_name, cpp_strerror(r)); if (r == -EPERM) { // propogate permission error - throw ceph::osd::permission_denied{}; + throw crimson::osd::permission_denied{}; } else { - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } } else { ceph_assert(cls); @@ -135,7 +135,7 @@ static inline std::unique_ptr<const PGLSFilter> get_pgls_filter( ClassHandler::ClassFilter * const class_filter = cls->get_filter(filter_name); if (class_filter == nullptr) { logger().warn("can't find filter {} in class {}", filter_name, class_name); - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } filter.reset(class_filter->fn()); @@ -144,7 +144,7 @@ static inline std::unique_ptr<const PGLSFilter> get_pgls_filter( // give an error rather than asserting out. logger().warn("buggy class {} failed to construct filter {}", class_name, filter_name); - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } } @@ -152,7 +152,7 @@ static inline std::unique_ptr<const PGLSFilter> get_pgls_filter( int r = filter->init(iter); if (r < 0) { logger().warn("error initializing filter {}: {}", type, cpp_strerror(r)); - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } // successfully constructed and initialized, return it. @@ -206,7 +206,7 @@ static seastar::future<ceph::bufferlist> do_pgnls_common( return backend.list_objects(lower_bound, limit).then( [&backend, filter, nspace](auto objects, auto next) { auto in_my_namespace = [&nspace](const hobject_t& obj) { - using ceph::common::local_conf; + using crimson::common::local_conf; if (obj.get_namespace() == local_conf()->osd_hit_set_namespace) { return false; } else if (nspace == librados::all_nspaces) { @@ -305,7 +305,7 @@ static seastar::future<> do_pgnls_filtered( ceph::decode(mname, bp); ceph::decode(type, bp); } catch (const buffer::error&) { - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } auto filter = get_pgls_filter(type, bp); @@ -416,7 +416,7 @@ OpsExecuter::execute_osd_op(OSDOp& osd_op) }); case CEPH_OSD_OP_OMAPSETVALS: if (!pg.get_pool().info.supports_omap()) { - throw ceph::osd::operation_not_supported{}; + throw crimson::osd::operation_not_supported{}; } return do_write_op([&osd_op] (auto& backend, auto& os, auto& txn) { return backend.omap_set_vals(os, osd_op, txn); @@ -528,7 +528,7 @@ static seastar::future<> do_pgls_filtered( ceph::decode(mname, bp); ceph::decode(type, bp); } catch (const buffer::error&) { - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } auto filter = get_pgls_filter(type, bp); @@ -589,4 +589,4 @@ OpsExecuter::execute_pg_op(OSDOp& osd_op) } } -} // namespace ceph::osd +} // namespace crimson::osd diff --git a/src/crimson/osd/ops_executer.h b/src/crimson/osd/ops_executer.h index 61f1d5b7371..4c4fa9415b2 100644 --- a/src/crimson/osd/ops_executer.h +++ b/src/crimson/osd/ops_executer.h @@ -34,7 +34,7 @@ class PGLSFilter; class OSDOp; -namespace ceph::osd { +namespace crimson::osd { class OpsExecuter { // an operation can be divided into two stages: main and effect-exposing // one. The former is performed immediately on call to `do_osd_op()` while @@ -93,7 +93,7 @@ class OpsExecuter { } seastar::future<> dont_do_legacy_op() { - throw ceph::osd::operation_not_supported(); + throw crimson::osd::operation_not_supported(); } public: @@ -162,4 +162,4 @@ seastar::future<> OpsExecuter::submit_changes(Func&& f) && { }); } -} // namespace ceph::osd +} // namespace crimson::osd diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index 0adcc1c3554..426e4f34fab 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -43,30 +43,30 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } static constexpr int TICK_INTERVAL = 1; } -using ceph::common::local_conf; -using ceph::os::FuturizedStore; +using crimson::common::local_conf; +using crimson::os::FuturizedStore; -namespace ceph::osd { +namespace crimson::osd { OSD::OSD(int id, uint32_t nonce, - ceph::net::Messenger& cluster_msgr, - ceph::net::Messenger& public_msgr, - ceph::net::Messenger& hb_front_msgr, - ceph::net::Messenger& hb_back_msgr) + crimson::net::Messenger& cluster_msgr, + crimson::net::Messenger& public_msgr, + crimson::net::Messenger& hb_front_msgr, + crimson::net::Messenger& hb_back_msgr) : whoami{id}, nonce{nonce}, // do this in background beacon_timer{[this] { (void)send_beacon(); }}, cluster_msgr{cluster_msgr}, public_msgr{public_msgr}, - monc{new ceph::mon::Client{public_msgr, *this}}, - mgrc{new ceph::mgr::Client{public_msgr, *this}}, - store{ceph::os::FuturizedStore::create( + monc{new crimson::mon::Client{public_msgr, *this}}, + mgrc{new crimson::mgr::Client{public_msgr, *this}}, + store{crimson::os::FuturizedStore::create( local_conf().get_val<std::string>("osd_objectstore"), local_conf().get_val<std::string>("osd_data"))}, shard_services{*this, cluster_msgr, public_msgr, *monc, *mgrc, *store}, @@ -222,7 +222,7 @@ seastar::future<> OSD::start() CEPH_FEATURE_UID | CEPH_FEATURE_PGID64 | CEPH_FEATURE_OSDENC; - using ceph::net::SocketPolicy; + using crimson::net::SocketPolicy; public_msgr.set_default_policy(SocketPolicy::stateless_server(0)); public_msgr.set_policy(entity_name_t::TYPE_MON, @@ -483,7 +483,7 @@ seastar::future<Ref<PG>> OSD::load_pg(spg_t pgid) }); } -seastar::future<> OSD::ms_dispatch(ceph::net::Connection* conn, MessageRef m) +seastar::future<> OSD::ms_dispatch(crimson::net::Connection* conn, MessageRef m) { if (state.is_stopping()) { return seastar::now(); @@ -522,7 +522,7 @@ seastar::future<> OSD::ms_dispatch(ceph::net::Connection* conn, MessageRef m) } } -seastar::future<> OSD::ms_handle_connect(ceph::net::ConnectionRef conn) +seastar::future<> OSD::ms_handle_connect(crimson::net::ConnectionRef conn) { if (conn->get_peer_type() != CEPH_ENTITY_TYPE_MON) { return seastar::now(); @@ -531,14 +531,14 @@ seastar::future<> OSD::ms_handle_connect(ceph::net::ConnectionRef conn) } } -seastar::future<> OSD::ms_handle_reset(ceph::net::ConnectionRef conn) +seastar::future<> OSD::ms_handle_reset(crimson::net::ConnectionRef conn) { // TODO: cleanup the session attached to this connection logger().warn("ms_handle_reset"); return seastar::now(); } -seastar::future<> OSD::ms_handle_remote_reset(ceph::net::ConnectionRef conn) +seastar::future<> OSD::ms_handle_remote_reset(crimson::net::ConnectionRef conn) { logger().warn("ms_handle_remote_reset"); return seastar::now(); @@ -647,7 +647,7 @@ seastar::future<> OSD::store_maps(ceph::os::Transaction& t, }); } -bool OSD::require_mon_peer(ceph::net::Connection *conn, Ref<Message> m) +bool OSD::require_mon_peer(crimson::net::Connection *conn, Ref<Message> m) { if (!conn->peer_is_mon()) { logger().info("{} received from non-mon {}, {}", @@ -750,7 +750,7 @@ seastar::future<Ref<PG>> OSD::handle_pg_create_info( }); } -seastar::future<> OSD::handle_osd_map(ceph::net::Connection* conn, +seastar::future<> OSD::handle_osd_map(crimson::net::Connection* conn, Ref<MOSDMap> m) { logger().info("handle_osd_map {}", *m); @@ -882,7 +882,7 @@ seastar::future<> OSD::committed_osd_maps(version_t first, }); } -seastar::future<> OSD::handle_osd_op(ceph::net::Connection* conn, +seastar::future<> OSD::handle_osd_op(crimson::net::Connection* conn, Ref<MOSDOp> m) { shard_services.start_operation<ClientRequest>( @@ -892,7 +892,7 @@ seastar::future<> OSD::handle_osd_op(ceph::net::Connection* conn, return seastar::now(); } -seastar::future<> OSD::handle_rep_op(ceph::net::Connection* conn, +seastar::future<> OSD::handle_rep_op(crimson::net::Connection* conn, Ref<MOSDRepOp> m) { m->finish_decode(); @@ -903,7 +903,7 @@ seastar::future<> OSD::handle_rep_op(ceph::net::Connection* conn, return seastar::now(); } -seastar::future<> OSD::handle_rep_op_reply(ceph::net::Connection* conn, +seastar::future<> OSD::handle_rep_op_reply(crimson::net::Connection* conn, Ref<MOSDRepOpReply> m) { const auto& pgs = pg_map.get_pgs(); @@ -996,7 +996,7 @@ seastar::future<> OSD::update_heartbeat_peers() } seastar::future<> OSD::handle_peering_op( - ceph::net::Connection* conn, + crimson::net::Connection* conn, Ref<MOSDPeeringOp> m) { const int from = m->get_source().num(); diff --git a/src/crimson/osd/osd.h b/src/crimson/osd/osd.h index 01c6b09b8ba..843c57e6f73 100644 --- a/src/crimson/osd/osd.h +++ b/src/crimson/osd/osd.h @@ -40,43 +40,46 @@ class OSDMap; class OSDMeta; class Heartbeat; -namespace ceph::mon { +namespace ceph::os { + class Transaction; +} + +namespace crimson::mon { class Client; } -namespace ceph::net { +namespace crimson::net { class Messenger; } -namespace ceph::os { +namespace crimson::os { class FuturizedStore; - class Transaction; } -namespace ceph::osd { +namespace crimson::osd { class PG; -class OSD final : public ceph::net::Dispatcher, +class OSD final : public crimson::net::Dispatcher, private OSDMapService, - private ceph::common::AuthHandler, - private ceph::mgr::WithStats { + private crimson::common::AuthHandler, + private crimson::mgr::WithStats { seastar::gate gate; const int whoami; const uint32_t nonce; seastar::timer<seastar::lowres_clock> beacon_timer; // talk with osd - ceph::net::Messenger& cluster_msgr; + crimson::net::Messenger& cluster_msgr; // talk with client/mon/mgr - ceph::net::Messenger& public_msgr; + crimson::net::Messenger& public_msgr; ChainedDispatchers dispatchers; - std::unique_ptr<ceph::mon::Client> monc; - std::unique_ptr<ceph::mgr::Client> mgrc; + std::unique_ptr<crimson::mon::Client> monc; + std::unique_ptr<crimson::mgr::Client> mgrc; SharedLRU<epoch_t, OSDMap> osdmaps; SimpleLRU<epoch_t, bufferlist, false> map_bl_cache; cached_map_t osdmap; // TODO: use a wrapper for ObjectStore - std::unique_ptr<ceph::os::FuturizedStore> store; + std::unique_ptr<crimson::os::FuturizedStore> store; std::unique_ptr<OSDMeta> meta_coll; OSDState state; @@ -95,10 +98,10 @@ class OSD final : public ceph::net::Dispatcher, OSDSuperblock superblock; // Dispatcher methods - seastar::future<> ms_dispatch(ceph::net::Connection* conn, MessageRef m) final; - seastar::future<> ms_handle_connect(ceph::net::ConnectionRef conn) final; - seastar::future<> ms_handle_reset(ceph::net::ConnectionRef conn) final; - seastar::future<> ms_handle_remote_reset(ceph::net::ConnectionRef conn) final; + seastar::future<> ms_dispatch(crimson::net::Connection* conn, MessageRef m) final; + seastar::future<> ms_handle_connect(crimson::net::ConnectionRef conn) final; + seastar::future<> ms_handle_reset(crimson::net::ConnectionRef conn) final; + seastar::future<> ms_handle_remote_reset(crimson::net::ConnectionRef conn) final; // mgr::WithStats methods MessageRef get_stats() final; @@ -107,7 +110,7 @@ class OSD final : public ceph::net::Dispatcher, void handle_authentication(const EntityName& name, const AuthCapsInfo& caps) final; - ceph::osd::ShardServices shard_services; + crimson::osd::ShardServices shard_services; std::unordered_map<spg_t, Ref<PG>> pgs; std::unique_ptr<Heartbeat> heartbeat; @@ -115,10 +118,10 @@ class OSD final : public ceph::net::Dispatcher, public: OSD(int id, uint32_t nonce, - ceph::net::Messenger& cluster_msgr, - ceph::net::Messenger& client_msgr, - ceph::net::Messenger& hb_front_msgr, - ceph::net::Messenger& hb_back_msgr); + crimson::net::Messenger& cluster_msgr, + crimson::net::Messenger& client_msgr, + crimson::net::Messenger& hb_front_msgr, + crimson::net::Messenger& hb_back_msgr); ~OSD() final; seastar::future<> mkfs(uuid_d osd_uuid, uuid_d cluster_fsid); @@ -156,20 +159,20 @@ private: void write_superblock(ceph::os::Transaction& t); seastar::future<> read_superblock(); - bool require_mon_peer(ceph::net::Connection *conn, Ref<Message> m); + bool require_mon_peer(crimson::net::Connection *conn, Ref<Message> m); seastar::future<Ref<PG>> handle_pg_create_info( std::unique_ptr<PGCreateInfo> info); - seastar::future<> handle_osd_map(ceph::net::Connection* conn, + seastar::future<> handle_osd_map(crimson::net::Connection* conn, Ref<MOSDMap> m); - seastar::future<> handle_osd_op(ceph::net::Connection* conn, + seastar::future<> handle_osd_op(crimson::net::Connection* conn, Ref<MOSDOp> m); - seastar::future<> handle_rep_op(ceph::net::Connection* conn, + seastar::future<> handle_rep_op(crimson::net::Connection* conn, Ref<MOSDRepOp> m); - seastar::future<> handle_rep_op_reply(ceph::net::Connection* conn, + seastar::future<> handle_rep_op_reply(crimson::net::Connection* conn, Ref<MOSDRepOpReply> m); - seastar::future<> handle_peering_op(ceph::net::Connection* conn, + seastar::future<> handle_peering_op(crimson::net::Connection* conn, Ref<MOSDPeeringOp> m); seastar::future<> committed_osd_maps(version_t first, diff --git a/src/crimson/osd/osd_connection_priv.h b/src/crimson/osd/osd_connection_priv.h index af377c9ba22..a265bb43268 100644 --- a/src/crimson/osd/osd_connection_priv.h +++ b/src/crimson/osd/osd_connection_priv.h @@ -9,15 +9,15 @@ #include "crimson/osd/osd_operations/peering_event.h" #include "crimson/osd/osd_operations/replicated_request.h" -namespace ceph::osd { +namespace crimson::osd { -struct OSDConnectionPriv : public ceph::net::Connection::user_private_t { +struct OSDConnectionPriv : public crimson::net::Connection::user_private_t { ClientRequest::ConnectionPipeline client_request_conn_pipeline; RemotePeeringEvent::ConnectionPipeline peering_request_conn_pipeline; RepRequest::ConnectionPipeline replicated_request_conn_pipeline; }; -static OSDConnectionPriv &get_osd_priv(ceph::net::Connection *conn) { +static OSDConnectionPriv &get_osd_priv(crimson::net::Connection *conn) { if (!conn->has_user_private()) { conn->set_user_private(std::make_unique<OSDConnectionPriv>()); } diff --git a/src/crimson/osd/osd_meta.h b/src/crimson/osd/osd_meta.h index 18cc0d86725..35e9a9c22f2 100644 --- a/src/crimson/osd/osd_meta.h +++ b/src/crimson/osd/osd_meta.h @@ -9,9 +9,12 @@ #include "osd/osd_types.h" namespace ceph::os { + class Transaction; +} + +namespace crimson::os { class FuturizedCollection; class FuturizedStore; - class Transaction; } /// metadata shared across PGs, or put in another way, @@ -19,12 +22,12 @@ namespace ceph::os { class OSDMeta { template<typename T> using Ref = boost::intrusive_ptr<T>; - ceph::os::FuturizedStore* store; - Ref<ceph::os::FuturizedCollection> coll; + crimson::os::FuturizedStore* store; + Ref<crimson::os::FuturizedCollection> coll; public: - OSDMeta(Ref<ceph::os::FuturizedCollection> coll, - ceph::os::FuturizedStore* store) + OSDMeta(Ref<crimson::os::FuturizedCollection> coll, + crimson::os::FuturizedStore* store) : store{store}, coll{coll} {} diff --git a/src/crimson/osd/osd_operation.cc b/src/crimson/osd/osd_operation.cc index 69ec5b7607b..03024cb2017 100644 --- a/src/crimson/osd/osd_operation.cc +++ b/src/crimson/osd/osd_operation.cc @@ -2,10 +2,11 @@ // vim: ts=8 sw=2 smarttab #include "osd_operation.h" +#include "common/Formatter.h" -namespace ceph::osd { +namespace crimson::osd { -void Operation::dump(Formatter *f) +void Operation::dump(ceph::Formatter* f) { f->open_object_section("operation"); f->dump_string("type", get_type_name()); @@ -23,7 +24,7 @@ void Operation::dump(Formatter *f) f->close_section(); } -void Operation::dump_brief(Formatter *f) +void Operation::dump_brief(ceph::Formatter* f) { f->open_object_section("operation"); f->dump_string("type", get_type_name()); @@ -38,7 +39,7 @@ std::ostream &operator<<(std::ostream &lhs, const Operation &rhs) { return lhs; } -void Blocker::dump(Formatter *f) const +void Blocker::dump(ceph::Formatter* f) const { f->open_object_section("blocker"); f->dump_string("op_type", get_type_name()); @@ -72,7 +73,7 @@ OrderedPipelinePhase::Handle::~Handle() exit(); } -void OrderedPipelinePhase::dump_detail(Formatter *f) const +void OrderedPipelinePhase::dump_detail(ceph::Formatter* f) const { } diff --git a/src/crimson/osd/osd_operation.h b/src/crimson/osd/osd_operation.h index 6c0305a814c..9d7861a0292 100644 --- a/src/crimson/osd/osd_operation.h +++ b/src/crimson/osd/osd_operation.h @@ -3,20 +3,21 @@ #pragma once -#include <seastar/core/shared_mutex.hh> -#include <seastar/core/future.hh> - -#include <vector> -#include <array> #include <algorithm> +#include <array> #include <set> +#include <vector> #include <boost/intrusive/list.hpp> #include <boost/intrusive_ptr.hpp> #include <boost/smart_ptr/intrusive_ref_counter.hpp> +#include <seastar/core/shared_mutex.hh> +#include <seastar/core/future.hh> -#include "common/Formatter.h" +namespace ceph { + class Formatter; +} -namespace ceph::osd { +namespace crimson::osd { enum class OperationTypeCode { client_request = 0, @@ -80,7 +81,7 @@ blocking_future<V...> make_ready_blocking_future(U&&... args) { */ class Blocker { protected: - virtual void dump_detail(Formatter *f) const = 0; + virtual void dump_detail(ceph::Formatter *f) const = 0; public: template <typename... T> @@ -88,7 +89,7 @@ public: return blocking_future(this, std::move(f)); } - void dump(Formatter *f) const; + void dump(ceph::Formatter *f) const; virtual const char *get_type_name() const = 0; @@ -121,7 +122,7 @@ class Operation : public boost::intrusive_ref_counter< id = in_id; } protected: - virtual void dump_detail(Formatter *f) const = 0; + virtual void dump_detail(ceph::Formatter *f) const = 0; public: uint64_t get_id() const { @@ -156,8 +157,8 @@ public: }); } - void dump(Formatter *f); - void dump_brief(Formatter *f); + void dump(ceph::Formatter *f); + void dump_brief(ceph::Formatter *f); virtual ~Operation() = default; }; using OperationRef = boost::intrusive_ptr<Operation>; @@ -168,7 +169,7 @@ template <typename T> class OperationT : public Operation { protected: - virtual void dump_detail(Formatter *f) const = 0; + virtual void dump_detail(ceph::Formatter *f) const = 0; public: static constexpr const char *type_name = OP_NAMES[static_cast<int>(T::type)]; @@ -231,7 +232,7 @@ class OrderedPipelinePhase : public Blocker { const char * name; protected: - virtual void dump_detail(Formatter *f) const final; + virtual void dump_detail(ceph::Formatter *f) const final; const char *get_type_name() const final { return name; } diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index 06f5669ddcd..7a84afbb0de 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -13,14 +13,14 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } -namespace ceph::osd { +namespace crimson::osd { ClientRequest::ClientRequest( - OSD &osd, ceph::net::ConnectionRef conn, Ref<MOSDOp> &&m) + OSD &osd, crimson::net::ConnectionRef conn, Ref<MOSDOp> &&m) : osd(osd), conn(conn), m(m) {} diff --git a/src/crimson/osd/osd_operations/client_request.h b/src/crimson/osd/osd_operations/client_request.h index 91bcfd3303a..8940194f62f 100644 --- a/src/crimson/osd/osd_operations/client_request.h +++ b/src/crimson/osd/osd_operations/client_request.h @@ -9,13 +9,13 @@ class MOSDOp; -namespace ceph::osd { +namespace crimson::osd { class PG; class OSD; class ClientRequest final : public OperationT<ClientRequest> { OSD &osd; - ceph::net::ConnectionRef conn; + crimson::net::ConnectionRef conn; Ref<MOSDOp> m; OrderedPipelinePhase::Handle handle; @@ -41,7 +41,7 @@ public: static constexpr OperationTypeCode type = OperationTypeCode::client_request; - ClientRequest(OSD &osd, ceph::net::ConnectionRef, Ref<MOSDOp> &&m); + ClientRequest(OSD &osd, crimson::net::ConnectionRef, Ref<MOSDOp> &&m); void print(std::ostream &) const final; void dump_detail(Formatter *f) const final; diff --git a/src/crimson/osd/osd_operations/compound_peering_request.cc b/src/crimson/osd/osd_operations/compound_peering_request.cc index df2262a3bab..fa1a45f9364 100644 --- a/src/crimson/osd/osd_operations/compound_peering_request.cc +++ b/src/crimson/osd/osd_operations/compound_peering_request.cc @@ -16,12 +16,12 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } namespace { -using namespace ceph::osd; +using namespace crimson::osd; struct compound_state { seastar::promise<BufferedRecoveryMessages> promise; @@ -42,7 +42,7 @@ public: PeeringSubEvent(compound_state_ref state, Args &&... args) : RemotePeeringEvent(std::forward<Args>(args)...), state(state) {} - seastar::future<> complete_rctx(Ref<ceph::osd::PG> pg) final { + seastar::future<> complete_rctx(Ref<crimson::osd::PG> pg) final { logger().debug("{}: submitting ctx transaction", *this); state->ctx.accept_buffered_messages(ctx); state = {}; @@ -58,7 +58,7 @@ public: std::vector<OperationRef> handle_pg_create( OSD &osd, - ceph::net::ConnectionRef conn, + crimson::net::ConnectionRef conn, compound_state_ref state, Ref<MOSDPGCreate2> m) { @@ -127,10 +127,10 @@ struct SubOpBlocker : BlockerT<SubOpBlocker> { } // namespace -namespace ceph::osd { +namespace crimson::osd { CompoundPeeringRequest::CompoundPeeringRequest( - OSD &osd, ceph::net::ConnectionRef conn, Ref<Message> m) + OSD &osd, crimson::net::ConnectionRef conn, Ref<Message> m) : osd(osd), conn(conn), m(m) @@ -173,4 +173,4 @@ seastar::future<> CompoundPeeringRequest::start() }); } -} // namespace ceph::osd +} // namespace crimson::osd diff --git a/src/crimson/osd/osd_operations/compound_peering_request.h b/src/crimson/osd/osd_operations/compound_peering_request.h index ac901f83530..495306d75d3 100644 --- a/src/crimson/osd/osd_operations/compound_peering_request.h +++ b/src/crimson/osd/osd_operations/compound_peering_request.h @@ -11,7 +11,7 @@ #include "crimson/net/Connection.h" #include "crimson/osd/osd_operation.h" -namespace ceph::osd { +namespace crimson::osd { class OSD; class PG; @@ -25,12 +25,12 @@ public: private: OSD &osd; - ceph::net::ConnectionRef conn; + crimson::net::ConnectionRef conn; Ref<Message> m; public: CompoundPeeringRequest( - OSD &osd, ceph::net::ConnectionRef conn, Ref<Message> m); + OSD &osd, crimson::net::ConnectionRef conn, Ref<Message> m); void print(std::ostream &) const final; void dump_detail(Formatter *f) const final; diff --git a/src/crimson/osd/osd_operations/peering_event.cc b/src/crimson/osd/osd_operations/peering_event.cc index 69d1f6b4404..9f1be69b604 100644 --- a/src/crimson/osd/osd_operations/peering_event.cc +++ b/src/crimson/osd/osd_operations/peering_event.cc @@ -13,11 +13,11 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } -namespace ceph::osd { +namespace crimson::osd { void PeeringEvent::print(std::ostream &lhs) const { diff --git a/src/crimson/osd/osd_operations/peering_event.h b/src/crimson/osd/osd_operations/peering_event.h index 1beb5f2612b..d9b57a3477a 100644 --- a/src/crimson/osd/osd_operations/peering_event.h +++ b/src/crimson/osd/osd_operations/peering_event.h @@ -11,7 +11,11 @@ #include "osd/PGPeeringEvent.h" #include "osd/PeeringState.h" -namespace ceph::osd { +namespace ceph { + class Formatter; +} + +namespace crimson::osd { class OSD; class ShardServices; @@ -72,14 +76,14 @@ public: void print(std::ostream &) const final; - void dump_detail(Formatter *f) const final; + void dump_detail(ceph::Formatter* f) const final; seastar::future<> start(); }; class RemotePeeringEvent : public PeeringEvent { protected: OSD &osd; - ceph::net::ConnectionRef conn; + crimson::net::ConnectionRef conn; void on_pg_absent() final; seastar::future<> complete_rctx(Ref<PG> pg) override; @@ -97,7 +101,7 @@ public: }; template <typename... Args> - RemotePeeringEvent(OSD &osd, ceph::net::ConnectionRef conn, Args&&... args) : + RemotePeeringEvent(OSD &osd, crimson::net::ConnectionRef conn, Args&&... args) : PeeringEvent(std::forward<Args>(args)...), osd(osd), conn(conn) diff --git a/src/crimson/osd/osd_operations/pg_advance_map.cc b/src/crimson/osd/osd_operations/pg_advance_map.cc index 2ce8f48a95d..48355f52f07 100644 --- a/src/crimson/osd/osd_operations/pg_advance_map.cc +++ b/src/crimson/osd/osd_operations/pg_advance_map.cc @@ -1,22 +1,23 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab -#include <seastar/core/future.hh> +#include "crimson/osd/osd_operations/pg_advance_map.h" #include <boost/smart_ptr/local_shared_ptr.hpp> +#include <seastar/core/future.hh> + #include "include/types.h" -#include "crimson/osd/osd_operations/pg_advance_map.h" +#include "common/Formatter.h" #include "crimson/osd/pg.h" #include "crimson/osd/osd.h" -#include "common/Formatter.h" namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } -namespace ceph::osd { +namespace crimson::osd { PGAdvanceMap::PGAdvanceMap( OSD &osd, Ref<PG> pg, epoch_t from, epoch_t to, diff --git a/src/crimson/osd/osd_operations/pg_advance_map.h b/src/crimson/osd/osd_operations/pg_advance_map.h index bed61558f96..1b27037eb41 100644 --- a/src/crimson/osd/osd_operations/pg_advance_map.h +++ b/src/crimson/osd/osd_operations/pg_advance_map.h @@ -11,7 +11,11 @@ #include "crimson/common/type_helpers.h" #include "osd/PeeringState.h" -namespace ceph::osd { +namespace ceph { + class Formatter; +} + +namespace crimson::osd { class OSD; class PG; @@ -39,7 +43,7 @@ public: ~PGAdvanceMap(); void print(std::ostream &) const final; - void dump_detail(Formatter *f) const final; + void dump_detail(ceph::Formatter *f) const final; seastar::future<> start(); }; diff --git a/src/crimson/osd/osd_operations/replicated_request.cc b/src/crimson/osd/osd_operations/replicated_request.cc index a89deed6f3c..34487f9e458 100644 --- a/src/crimson/osd/osd_operations/replicated_request.cc +++ b/src/crimson/osd/osd_operations/replicated_request.cc @@ -12,14 +12,14 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } -namespace ceph::osd { +namespace crimson::osd { RepRequest::RepRequest(OSD &osd, - ceph::net::ConnectionRef&& conn, + crimson::net::ConnectionRef&& conn, Ref<MOSDRepOp> &&req) : osd{osd}, conn{std::move(conn)}, diff --git a/src/crimson/osd/osd_operations/replicated_request.h b/src/crimson/osd/osd_operations/replicated_request.h index a835aed32ff..8e9cfc9fe41 100644 --- a/src/crimson/osd/osd_operations/replicated_request.h +++ b/src/crimson/osd/osd_operations/replicated_request.h @@ -9,7 +9,11 @@ class MOSDRepOp; -namespace ceph::osd { +namespace ceph { + class Formatter; +} + +namespace crimson::osd { class OSD; class PG; @@ -35,10 +39,10 @@ public: friend RepRequest; }; static constexpr OperationTypeCode type = OperationTypeCode::replicated_request; - RepRequest(OSD&, ceph::net::ConnectionRef&&, Ref<MOSDRepOp>&&); + RepRequest(OSD&, crimson::net::ConnectionRef&&, Ref<MOSDRepOp>&&); void print(std::ostream &) const final; - void dump_detail(Formatter *f) const final; + void dump_detail(ceph::Formatter* f) const final; seastar::future<> start(); private: @@ -46,7 +50,7 @@ private: PGPipeline &pp(PG &pg); OSD &osd; - ceph::net::ConnectionRef conn; + crimson::net::ConnectionRef conn; Ref<MOSDRepOp> req; OrderedPipelinePhase::Handle handle; }; diff --git a/src/crimson/osd/osdmap_gate.cc b/src/crimson/osd/osdmap_gate.cc index f83743419a1..98d86c1c656 100644 --- a/src/crimson/osd/osdmap_gate.cc +++ b/src/crimson/osd/osdmap_gate.cc @@ -7,11 +7,11 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } -namespace ceph::osd { +namespace crimson::osd { void OSDMapGate::OSDMapBlocker::dump_detail(Formatter *f) const { diff --git a/src/crimson/osd/osdmap_gate.h b/src/crimson/osd/osdmap_gate.h index 073ce843f95..0d7fa2ad410 100644 --- a/src/crimson/osd/osdmap_gate.h +++ b/src/crimson/osd/osdmap_gate.h @@ -15,12 +15,11 @@ namespace ceph { class Formatter; - namespace osd { - class ShardServices; - } } -namespace ceph::osd { +namespace crimson::osd { + +class ShardServices; class OSDMapGate { struct OSDMapBlocker : public Blocker { diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 8372eea45f3..0a958ee64e6 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -40,7 +40,7 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } @@ -54,9 +54,9 @@ std::ostream& operator<<(std::ostream& out, const signedspan& d) } } -namespace ceph::osd { +namespace crimson::osd { -using ceph::common::local_conf; +using crimson::common::local_conf; class RecoverablePredicate : public IsPGRecoverablePredicate { public: @@ -77,7 +77,7 @@ public: PG::PG( spg_t pgid, pg_shard_t pg_shard, - ceph::os::CollectionRef coll_ref, + crimson::os::CollectionRef coll_ref, pg_pool_t&& pool, std::string&& name, cached_map_t osdmap, @@ -275,7 +275,7 @@ void PG::schedule_renew_lease(epoch_t last_peering_reset, ceph::timespan delay) void PG::init( - ceph::os::CollectionRef coll, + crimson::os::CollectionRef coll, int role, const vector<int>& newup, int new_up_primary, const vector<int>& newacting, int new_acting_primary, @@ -290,7 +290,7 @@ void PG::init( new_acting_primary, history, pi, backfill, t); } -seastar::future<> PG::read_state(ceph::os::FuturizedStore* store) +seastar::future<> PG::read_state(crimson::os::FuturizedStore* store) { return store->open_collection(coll_t(pgid)).then([this, store](auto ch) { coll_ref = ch; @@ -461,8 +461,8 @@ seastar::future<Ref<MOSDOpReply>> PG::do_osd_ops(Ref<MOSDOp> m) 0, false); reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK); return seastar::make_ready_future<Ref<MOSDOpReply>>(std::move(reply)); - }).handle_exception_type([=,&oid](const ceph::osd::error& e) { - logger().debug("got ceph::osd::error while handling object {}: {} ({})", + }).handle_exception_type([=,&oid](const crimson::osd::error& e) { + logger().debug("got crimson::osd::error while handling object {}: {} ({})", oid, e.code(), e.what()); return backend->evict_object_state(oid).then([=] { auto reply = make_message<MOSDOpReply>( @@ -487,7 +487,7 @@ seastar::future<Ref<MOSDOpReply>> PG::do_pg_ops(Ref<MOSDOp> m) CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK, false); return seastar::make_ready_future<Ref<MOSDOpReply>>(std::move(reply)); - }).handle_exception_type([=](const ceph::osd::error& e) { + }).handle_exception_type([=](const crimson::osd::error& e) { auto reply = make_message<MOSDOpReply>( m.get(), -e.code().value(), get_osdmap_epoch(), 0, false); reply->set_enoent_reply_versions(peering_state.get_info().last_update, @@ -496,7 +496,7 @@ seastar::future<Ref<MOSDOpReply>> PG::do_pg_ops(Ref<MOSDOp> m) }); } -seastar::future<> PG::handle_op(ceph::net::Connection* conn, +seastar::future<> PG::handle_op(crimson::net::Connection* conn, Ref<MOSDOp> m) { return wait_for_active().then([conn, m, this] { @@ -531,7 +531,7 @@ seastar::future<> PG::handle_rep_op(Ref<MOSDRepOp> req) }); } -void PG::handle_rep_op_reply(ceph::net::Connection* conn, +void PG::handle_rep_op_reply(crimson::net::Connection* conn, const MOSDRepOpReply& m) { backend->got_rep_op_reply(m); diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index 6a87b701c1d..4c5cd11b542 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -34,15 +34,15 @@ namespace recovery { class Context; } -namespace ceph::net { +namespace crimson::net { class Messenger; } -namespace ceph::os { +namespace crimson::os { class FuturizedStore; } -namespace ceph::osd { +namespace crimson::osd { class ClientRequest; class PG : public boost::intrusive_ref_counter< @@ -61,12 +61,12 @@ class PG : public boost::intrusive_ref_counter< spg_t pgid; pg_shard_t pg_whoami; coll_t coll; - ceph::os::CollectionRef coll_ref; + crimson::os::CollectionRef coll_ref; ghobject_t pgmeta_oid; public: PG(spg_t pgid, pg_shard_t pg_shard, - ceph::os::CollectionRef coll_ref, + crimson::os::CollectionRef coll_ref, pg_pool_t&& pool, std::string&& name, cached_map_t osdmap, @@ -106,7 +106,7 @@ public: return ceph_subsys_osd; } - ceph::os::CollectionRef get_collection_ref() { + crimson::os::CollectionRef get_collection_ref() { return coll_ref; } @@ -119,7 +119,7 @@ public: bool dirty_info, bool dirty_big_info, bool need_write_epoch, - ObjectStore::Transaction &t) final { + ceph::os::Transaction &t) final { std::map<string,bufferlist> km; if (dirty_big_info || dirty_info) { int ret = prepare_info_keymap( @@ -168,7 +168,7 @@ public: bool try_flush_or_schedule_async() final; void start_flush_on_transaction( - ObjectStore::Transaction &t) final { + ceph::os::Transaction &t) final { t.register_on_commit( new LambdaContext([this](int r){ peering_state.complete_flush(); @@ -213,7 +213,7 @@ public: } void schedule_event_on_commit( - ObjectStore::Transaction &t, + ceph::os::Transaction &t, PGPeeringEventRef on_commit) final { t.register_on_commit( new LambdaContext( @@ -268,7 +268,7 @@ public: void on_role_change() final { // Not needed yet } - void on_change(ObjectStore::Transaction &t) final { + void on_change(ceph::os::Transaction &t) final { // Not needed yet } void on_activate(interval_set<snapid_t> to_trim) final; @@ -287,10 +287,10 @@ public: // Not needed yet } - void on_removal(ObjectStore::Transaction &t) final { + void on_removal(ceph::os::Transaction &t) final { // TODO } - void do_delete_work(ObjectStore::Transaction &t) final { + void do_delete_work(ceph::os::Transaction &t) final { // TODO } @@ -332,8 +332,8 @@ public: struct PGLogEntryHandler : public PGLog::LogEntryHandler { PG *pg; - ObjectStore::Transaction *t; - PGLogEntryHandler(PG *pg, ObjectStore::Transaction *t) : pg(pg), t(t) {} + ceph::os::Transaction *t; + PGLogEntryHandler(PG *pg, ceph::os::Transaction *t) : pg(pg), t(t) {} // LogEntryHandler void remove(const hobject_t &hoid) override { @@ -353,7 +353,7 @@ public: } }; PGLog::LogEntryHandlerRef get_log_handler( - ObjectStore::Transaction &t) final { + ceph::os::Transaction &t) final { return std::make_unique<PG::PGLogEntryHandler>(this, &t); } @@ -416,7 +416,7 @@ public: /// initialize created PG void init( - ceph::os::CollectionRef coll_ref, + crimson::os::CollectionRef coll_ref, int role, const std::vector<int>& up, int up_primary, @@ -425,9 +425,9 @@ public: const pg_history_t& history, const PastIntervals& pim, bool backfill, - ObjectStore::Transaction &t); + ceph::os::Transaction &t); - seastar::future<> read_state(ceph::os::FuturizedStore* store); + seastar::future<> read_state(crimson::os::FuturizedStore* store); void do_peering_event( PGPeeringEvent& evt, PeeringCtx &rctx); @@ -435,10 +435,10 @@ public: void handle_advance_map(cached_map_t next_map, PeeringCtx &rctx); void handle_activate_map(PeeringCtx &rctx); void handle_initialize(PeeringCtx &rctx); - seastar::future<> handle_op(ceph::net::Connection* conn, + seastar::future<> handle_op(crimson::net::Connection* conn, Ref<MOSDOp> m); seastar::future<> handle_rep_op(Ref<MOSDRepOp> m); - void handle_rep_op_reply(ceph::net::Connection* conn, + void handle_rep_op_reply(crimson::net::Connection* conn, const MOSDRepOpReply& m); void print(std::ostream& os) const; diff --git a/src/crimson/osd/pg_backend.cc b/src/crimson/osd/pg_backend.cc index 63d4475ac3f..4f7b3c88772 100644 --- a/src/crimson/osd/pg_backend.cc +++ b/src/crimson/osd/pg_backend.cc @@ -11,6 +11,7 @@ #include <seastar/core/print.hh> #include "messages/MOSDOp.h" +#include "os/Transaction.h" #include "crimson/os/futurized_collection.h" #include "crimson/os/cyan_object.h" @@ -21,18 +22,19 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } -using ceph::common::local_conf; +using crimson::common::local_conf; -std::unique_ptr<PGBackend> PGBackend::create(pg_t pgid, - const pg_shard_t pg_shard, - const pg_pool_t& pool, - ceph::os::CollectionRef coll, - ceph::osd::ShardServices& shard_services, - const ec_profile_t& ec_profile) +std::unique_ptr<PGBackend> +PGBackend::create(pg_t pgid, + const pg_shard_t pg_shard, + const pg_pool_t& pool, + crimson::os::CollectionRef coll, + crimson::osd::ShardServices& shard_services, + const ec_profile_t& ec_profile) { switch (pool.type) { case pg_pool_t::TYPE_REPLICATED: @@ -50,7 +52,7 @@ std::unique_ptr<PGBackend> PGBackend::create(pg_t pgid, PGBackend::PGBackend(shard_id_t shard, CollectionRef coll, - ceph::os::FuturizedStore* store) + crimson::os::FuturizedStore* store) : shard{shard}, coll{coll}, store{store} @@ -75,7 +77,7 @@ PGBackend::get_object_state(const hobject_t& oid) oid.snap); if (clone == end(ss->clones)) { return seastar::make_exception_future<PGBackend::cached_os_t>( - ceph::osd::object_not_found{}); + crimson::osd::object_not_found{}); } // clone auto soid = oid; @@ -86,7 +88,7 @@ PGBackend::get_object_state(const hobject_t& oid) if (clone_snap->second.empty()) { logger().trace("find_object: {}@[] -- DNE", soid); return seastar::make_exception_future<PGBackend::cached_os_t>( - ceph::osd::object_not_found{}); + crimson::osd::object_not_found{}); } auto first = clone_snap->second.back(); auto last = clone_snap->second.front(); @@ -94,7 +96,7 @@ PGBackend::get_object_state(const hobject_t& oid) logger().trace("find_object: {}@[{},{}] -- DNE", soid, first, last); return seastar::make_exception_future<PGBackend::cached_os_t>( - ceph::osd::object_not_found{}); + crimson::osd::object_not_found{}); } logger().trace("find_object: {}@[{},{}] -- HIT", soid, first, last); @@ -116,7 +118,7 @@ PGBackend::_load_os(const hobject_t& oid) OI_ATTR).then_wrapped([oid, this](auto fut) { if (fut.failed()) { auto ep = std::move(fut).get_exception(); - if (!ceph::os::FuturizedStore::EnoentException::is_class_of(ep)) { + if (!crimson::os::FuturizedStore::EnoentException::is_class_of(ep)) { std::rethrow_exception(ep); } return seastar::make_ready_future<cached_os_t>( @@ -145,7 +147,7 @@ PGBackend::_load_ss(const hobject_t& oid) std::unique_ptr<SnapSet> snapset; if (fut.failed()) { auto ep = std::move(fut).get_exception(); - if (!ceph::os::FuturizedStore::EnoentException::is_class_of(ep)) { + if (!crimson::os::FuturizedStore::EnoentException::is_class_of(ep)) { std::rethrow_exception(ep); } else { snapset = std::make_unique<SnapSet>(); @@ -161,7 +163,7 @@ PGBackend::_load_ss(const hobject_t& oid) }); } -seastar::future<ceph::osd::acked_peers_t> +seastar::future<crimson::osd::acked_peers_t> PGBackend::mutate_object( std::set<pg_shard_t> pg_shards, cached_os_t&& os, @@ -239,7 +241,7 @@ seastar::future<bufferlist> PGBackend::read(const object_info_t& oi, logger().error("full-object read crc {} != expected {} on {}", crc, *maybe_crc, soid); // todo: mark soid missing, perform recovery, and retry - throw ceph::osd::object_corrupted{}; + throw crimson::osd::object_corrupted{}; } } return seastar::make_ready_future<bufferlist>(std::move(bl)); @@ -256,7 +258,7 @@ seastar::future<> PGBackend::stat( encode(os.oi.mtime, osd_op.outdata); } else { logger().debug("stat object does not exist"); - throw ceph::osd::object_not_found{}; + throw crimson::osd::object_not_found{}; } return seastar::now(); // TODO: ctx->delta_stats.num_rd++; @@ -340,7 +342,7 @@ seastar::future<> PGBackend::writefull( { const ceph_osd_op& op = osd_op.op; if (op.extent.length != osd_op.indata.length()) { - throw ceph::osd::invalid_argument(); + throw crimson::osd::invalid_argument(); } const bool existing = maybe_create_new_object(os, txn); @@ -363,7 +365,7 @@ seastar::future<> PGBackend::create( if (os.exists && !os.oi.is_whiteout() && (osd_op.op.flags & CEPH_OSD_OP_FLAG_EXCL)) { // this is an exclusive create - throw ceph::osd::make_error(-EEXIST); + throw crimson::osd::make_error(-EEXIST); } if (osd_op.indata.length()) { @@ -373,7 +375,7 @@ seastar::future<> PGBackend::create( std::string category; decode(category, p); } catch (buffer::error&) { - throw ceph::osd::invalid_argument(); + throw crimson::osd::invalid_argument(); } } maybe_create_new_object(os, txn); @@ -433,13 +435,13 @@ seastar::future<> PGBackend::setxattr( { if (local_conf()->osd_max_attr_size > 0 && osd_op.op.xattr.value_len > local_conf()->osd_max_attr_size) { - throw ceph::osd::make_error(-EFBIG); + throw crimson::osd::make_error(-EFBIG); } const auto max_name_len = std::min<uint64_t>( store->get_max_attr_name_length(), local_conf()->osd_max_attr_name_len); if (osd_op.op.xattr.name_len > max_name_len) { - throw ceph::osd::make_error(-ENAMETOOLONG); + throw crimson::osd::make_error(-ENAMETOOLONG); } maybe_create_new_object(os, txn); @@ -479,11 +481,11 @@ seastar::future<> PGBackend::getxattr( osd_op.op.xattr.value_len = osd_op.outdata.length(); //ctx->delta_stats.num_rd_kb += shift_round_up(osd_op.outdata.length(), 10); }).handle_exception_type( - [] (ceph::os::FuturizedStore::EnoentException&) { - return seastar::make_exception_future<>(ceph::osd::object_not_found{}); + [] (crimson::os::FuturizedStore::EnoentException&) { + return seastar::make_exception_future<>(crimson::osd::object_not_found{}); }).handle_exception_type( - [] (ceph::os::FuturizedStore::EnodataException&) { - return seastar::make_exception_future<>(ceph::osd::no_message_available{}); + [] (crimson::os::FuturizedStore::EnodataException&) { + return seastar::make_exception_future<>(crimson::osd::no_message_available{}); }); //ctx->delta_stats.num_rd++; } @@ -495,7 +497,7 @@ seastar::future<ceph::bufferptr> PGBackend::getxattr( return store->get_attr(coll, ghobject_t{soid}, key); } -static seastar::future<ceph::os::FuturizedStore::omap_values_t> +static seastar::future<crimson::os::FuturizedStore::omap_values_t> maybe_get_omap_vals_by_keys( auto& store, const auto& coll, @@ -505,12 +507,12 @@ maybe_get_omap_vals_by_keys( if (oi.is_omap()) { return store->omap_get_values(coll, ghobject_t{oi.soid}, keys_to_get); } else { - return seastar::make_ready_future<ceph::os::FuturizedStore::omap_values_t>( - ceph::os::FuturizedStore::omap_values_t{}); + return seastar::make_ready_future<crimson::os::FuturizedStore::omap_values_t>( + crimson::os::FuturizedStore::omap_values_t{}); } } -static seastar::future<bool, ceph::os::FuturizedStore::omap_values_t> +static seastar::future<bool, crimson::os::FuturizedStore::omap_values_t> maybe_get_omap_vals( auto& store, const auto& coll, @@ -520,8 +522,8 @@ maybe_get_omap_vals( if (oi.is_omap()) { return store->omap_get_values(coll, ghobject_t{oi.soid}, start_after); } else { - return seastar::make_ready_future<bool, ceph::os::FuturizedStore::omap_values_t>( - true, ceph::os::FuturizedStore::omap_values_t{}); + return seastar::make_ready_future<bool, crimson::os::FuturizedStore::omap_values_t>( + true, crimson::os::FuturizedStore::omap_values_t{}); } } @@ -536,14 +538,14 @@ seastar::future<> PGBackend::omap_get_keys( decode(start_after, p); decode(max_return, p); } catch (buffer::error&) { - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } max_return = std::min(max_return, local_conf()->osd_max_omap_entries_per_request); // TODO: truly chunk the reading return maybe_get_omap_vals(store, coll, os.oi, start_after).then( - [=, &osd_op] (bool, ceph::os::FuturizedStore::omap_values_t vals) { + [=, &osd_op] (bool, crimson::os::FuturizedStore::omap_values_t vals) { ceph::bufferlist result; bool truncated = false; uint32_t num = 0; @@ -579,7 +581,7 @@ seastar::future<> PGBackend::omap_get_vals( decode(max_return, p); decode(filter_prefix, p); } catch (buffer::error&) { - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } max_return = \ @@ -588,7 +590,7 @@ seastar::future<> PGBackend::omap_get_vals( // TODO: truly chunk the reading return maybe_get_omap_vals(store, coll, os.oi, start_after).then( [=, &osd_op] (const bool done, - ceph::os::FuturizedStore::omap_values_t vals) { + crimson::os::FuturizedStore::omap_values_t vals) { assert(done); ceph::bufferlist result; bool truncated = false; @@ -626,11 +628,11 @@ seastar::future<> PGBackend::omap_get_vals_by_keys( auto p = osd_op.indata.cbegin(); decode(keys_to_get, p); } catch (buffer::error&) { - throw ceph::osd::invalid_argument(); + throw crimson::osd::invalid_argument(); } return maybe_get_omap_vals_by_keys(store, coll, os.oi, keys_to_get).then( - [&osd_op] (ceph::os::FuturizedStore::omap_values_t vals) { + [&osd_op] (crimson::os::FuturizedStore::omap_values_t vals) { encode(vals, osd_op.outdata); return seastar::now(); }); @@ -652,7 +654,7 @@ seastar::future<> PGBackend::omap_set_vals( auto p = osd_op.indata.cbegin(); decode_str_str_map_to_bl(p, &to_set_bl); } catch (buffer::error&) { - throw ceph::osd::invalid_argument{}; + throw crimson::osd::invalid_argument{}; } txn.omap_setkeys(coll->get_cid(), ghobject_t{os.oi.soid}, to_set_bl); diff --git a/src/crimson/osd/pg_backend.h b/src/crimson/osd/pg_backend.h index f703b51138a..b4a7b74a5df 100644 --- a/src/crimson/osd/pg_backend.h +++ b/src/crimson/osd/pg_backend.h @@ -12,31 +12,34 @@ #include "crimson/os/futurized_collection.h" #include "crimson/osd/acked_peers.h" #include "crimson/common/shared_lru.h" -#include "os/Transaction.h" #include "osd/osd_types.h" #include "osd/osd_internal_types.h" struct hobject_t; class MOSDRepOpReply; -namespace ceph::osd { +namespace ceph::os { + class Transaction; +} + +namespace crimson::osd { class ShardServices; } class PGBackend { protected: - using CollectionRef = ceph::os::CollectionRef; + using CollectionRef = crimson::os::CollectionRef; using ec_profile_t = std::map<std::string, std::string>; public: - PGBackend(shard_id_t shard, CollectionRef coll, ceph::os::FuturizedStore* store); + PGBackend(shard_id_t shard, CollectionRef coll, crimson::os::FuturizedStore* store); virtual ~PGBackend() = default; static std::unique_ptr<PGBackend> create(pg_t pgid, const pg_shard_t pg_shard, const pg_pool_t& pool, - ceph::os::CollectionRef coll, - ceph::osd::ShardServices& shard_services, + crimson::os::CollectionRef coll, + crimson::osd::ShardServices& shard_services, const ec_profile_t& ec_profile); using cached_os_t = boost::local_shared_ptr<ObjectState>; seastar::future<cached_os_t> get_object_state(const hobject_t& oid); @@ -66,7 +69,7 @@ public: ObjectState& os, const OSDOp& osd_op, ceph::os::Transaction& trans); - seastar::future<ceph::osd::acked_peers_t> mutate_object( + seastar::future<crimson::osd::acked_peers_t> mutate_object( std::set<pg_shard_t> pg_shards, cached_os_t&& os, ceph::os::Transaction&& txn, @@ -108,7 +111,7 @@ public: protected: const shard_id_t shard; CollectionRef coll; - ceph::os::FuturizedStore* store; + crimson::os::FuturizedStore* store; private: using cached_ss_t = boost::local_shared_ptr<SnapSet>; @@ -121,7 +124,7 @@ private: size_t length, uint32_t flags) = 0; bool maybe_create_new_object(ObjectState& os, ceph::os::Transaction& txn); - virtual seastar::future<ceph::osd::acked_peers_t> + virtual seastar::future<crimson::osd::acked_peers_t> _submit_transaction(std::set<pg_shard_t>&& pg_shards, const hobject_t& hoid, ceph::os::Transaction&& txn, diff --git a/src/crimson/osd/pg_map.cc b/src/crimson/osd/pg_map.cc index 536ba9980e5..93d99ce9982 100644 --- a/src/crimson/osd/pg_map.cc +++ b/src/crimson/osd/pg_map.cc @@ -8,11 +8,11 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } -namespace ceph::osd { +namespace crimson::osd { PGMap::PGCreationState::PGCreationState(spg_t pgid) : pgid(pgid) {} PGMap::PGCreationState::~PGCreationState() {} diff --git a/src/crimson/osd/pg_map.h b/src/crimson/osd/pg_map.h index a17388c1b3b..1018d5ac517 100644 --- a/src/crimson/osd/pg_map.h +++ b/src/crimson/osd/pg_map.h @@ -14,7 +14,7 @@ #include "crimson/osd/pg.h" #include "osd/osd_types.h" -namespace ceph::osd { +namespace crimson::osd { class PG; class PGMap { diff --git a/src/crimson/osd/pg_meta.cc b/src/crimson/osd/pg_meta.cc index 969060d4b2d..642a18c64be 100644 --- a/src/crimson/osd/pg_meta.cc +++ b/src/crimson/osd/pg_meta.cc @@ -7,7 +7,7 @@ // prefix pgmeta_oid keys with _ so that PGLog::read_log_and_missing() can // easily skip them -using ceph::os::FuturizedStore; +using crimson::os::FuturizedStore; PGMeta::PGMeta(FuturizedStore* store, spg_t pgid) : store{store}, diff --git a/src/crimson/osd/pg_meta.h b/src/crimson/osd/pg_meta.h index 7baacca89ed..656d5b9be09 100644 --- a/src/crimson/osd/pg_meta.h +++ b/src/crimson/osd/pg_meta.h @@ -6,17 +6,17 @@ #include <seastar/core/future.hh> #include "osd/osd_types.h" -namespace ceph::os { +namespace crimson::os { class FuturizedStore; } /// PG related metadata class PGMeta { - ceph::os::FuturizedStore* store; + crimson::os::FuturizedStore* store; const spg_t pgid; public: - PGMeta(ceph::os::FuturizedStore *store, spg_t pgid); + PGMeta(crimson::os::FuturizedStore *store, spg_t pgid); seastar::future<epoch_t> get_epoch(); seastar::future<pg_info_t, PastIntervals> load(); }; diff --git a/src/crimson/osd/replicated_backend.cc b/src/crimson/osd/replicated_backend.cc index 9cddf664e0c..a72d3f19462 100644 --- a/src/crimson/osd/replicated_backend.cc +++ b/src/crimson/osd/replicated_backend.cc @@ -9,14 +9,14 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } ReplicatedBackend::ReplicatedBackend(pg_t pgid, pg_shard_t whoami, ReplicatedBackend::CollectionRef coll, - ceph::osd::ShardServices& shard_services) + crimson::osd::ShardServices& shard_services) : PGBackend{whoami.shard, coll, &shard_services.get_store()}, pgid{pgid}, whoami{whoami}, @@ -31,7 +31,7 @@ seastar::future<bufferlist> ReplicatedBackend::_read(const hobject_t& hoid, return store->read(coll, ghobject_t{hoid}, off, len, flags); } -seastar::future<ceph::osd::acked_peers_t> +seastar::future<crimson::osd::acked_peers_t> ReplicatedBackend::_submit_transaction(std::set<pg_shard_t>&& pg_shards, const hobject_t& hoid, ceph::os::Transaction&& txn, @@ -70,7 +70,7 @@ ReplicatedBackend::_submit_transaction(std::set<pg_shard_t>&& pg_shards, pending_txn->second.all_committed = {}; auto acked_peers = std::move(pending_txn->second.acked_peers); pending_trans.erase(pending_txn); - return seastar::make_ready_future<ceph::osd::acked_peers_t>(std::move(acked_peers)); + return seastar::make_ready_future<crimson::osd::acked_peers_t>(std::move(acked_peers)); }); } diff --git a/src/crimson/osd/replicated_backend.h b/src/crimson/osd/replicated_backend.h index ca9ccb1db4f..03f410c372a 100644 --- a/src/crimson/osd/replicated_backend.h +++ b/src/crimson/osd/replicated_backend.h @@ -11,7 +11,7 @@ #include "acked_peers.h" #include "pg_backend.h" -namespace ceph::osd { +namespace crimson::osd { class ShardServices; } @@ -20,14 +20,14 @@ class ReplicatedBackend : public PGBackend public: ReplicatedBackend(pg_t pgid, pg_shard_t whoami, CollectionRef coll, - ceph::osd::ShardServices& shard_services); + crimson::osd::ShardServices& shard_services); void got_rep_op_reply(const MOSDRepOpReply& reply) final; private: seastar::future<ceph::bufferlist> _read(const hobject_t& hoid, uint64_t off, uint64_t len, uint32_t flags) override; - seastar::future<ceph::osd::acked_peers_t> + seastar::future<crimson::osd::acked_peers_t> _submit_transaction(std::set<pg_shard_t>&& pg_shards, const hobject_t& hoid, ceph::os::Transaction&& txn, @@ -36,14 +36,14 @@ private: eversion_t ver) final; const pg_t pgid; const pg_shard_t whoami; - ceph::osd::ShardServices& shard_services; + crimson::osd::ShardServices& shard_services; ceph_tid_t next_txn_id = 0; struct pending_on_t { pending_on_t(size_t pending) : pending{static_cast<unsigned>(pending)} {} unsigned pending; - ceph::osd::acked_peers_t acked_peers; + crimson::osd::acked_peers_t acked_peers; seastar::promise<> all_committed; }; using pending_transactions_t = std::map<ceph_tid_t, pending_on_t>; diff --git a/src/crimson/osd/shard_services.cc b/src/crimson/osd/shard_services.cc index c029674f1de..f5c240f0a8a 100644 --- a/src/crimson/osd/shard_services.cc +++ b/src/crimson/osd/shard_services.cc @@ -20,19 +20,19 @@ namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_osd); + return crimson::get_logger(ceph_subsys_osd); } } -namespace ceph::osd { +namespace crimson::osd { ShardServices::ShardServices( OSDMapService &osdmap_service, - ceph::net::Messenger &cluster_msgr, - ceph::net::Messenger &public_msgr, - ceph::mon::Client &monc, - ceph::mgr::Client &mgrc, - ceph::os::FuturizedStore &store) + crimson::net::Messenger &cluster_msgr, + crimson::net::Messenger &public_msgr, + crimson::mon::Client &monc, + crimson::mgr::Client &mgrc, + crimson::os::FuturizedStore &store) : osdmap_service(osdmap_service), cluster_msgr(cluster_msgr), public_msgr(public_msgr), @@ -66,7 +66,7 @@ seastar::future<> ShardServices::send_to_osd( } seastar::future<> ShardServices::dispatch_context_transaction( - ceph::os::CollectionRef col, PeeringCtx &ctx) { + crimson::os::CollectionRef col, PeeringCtx &ctx) { auto ret = store.do_transaction( col, std::move(ctx.transaction)); @@ -90,7 +90,7 @@ seastar::future<> ShardServices::dispatch_context_messages( } seastar::future<> ShardServices::dispatch_context( - ceph::os::CollectionRef col, + crimson::os::CollectionRef col, PeeringCtx &&ctx) { ceph_assert(col || ctx.transaction.empty()); diff --git a/src/crimson/osd/shard_services.h b/src/crimson/osd/shard_services.h index 407fa8a3643..d19aa648d85 100644 --- a/src/crimson/osd/shard_services.h +++ b/src/crimson/osd/shard_services.h @@ -12,19 +12,19 @@ #include "osd/PeeringState.h" #include "crimson/osd/osdmap_service.h" -namespace ceph::net { +namespace crimson::net { class Messenger; } -namespace ceph::mgr { +namespace crimson::mgr { class Client; } -namespace ceph::mon { +namespace crimson::mon { class Client; } -namespace ceph::os { +namespace crimson::os { class FuturizedStore; } @@ -33,7 +33,7 @@ class OSDMap; class PeeringCtx; class BufferedRecoveryMessages; -namespace ceph::osd { +namespace crimson::osd { /** * Represents services available to each PG @@ -41,11 +41,11 @@ namespace ceph::osd { class ShardServices { using cached_map_t = boost::local_shared_ptr<const OSDMap>; OSDMapService &osdmap_service; - ceph::net::Messenger &cluster_msgr; - ceph::net::Messenger &public_msgr; - ceph::mon::Client &monc; - ceph::mgr::Client &mgrc; - ceph::os::FuturizedStore &store; + crimson::net::Messenger &cluster_msgr; + crimson::net::Messenger &public_msgr; + crimson::mon::Client &monc; + crimson::mgr::Client &mgrc; + crimson::os::FuturizedStore &store; CephContext cct; @@ -55,18 +55,18 @@ class ShardServices { public: ShardServices( OSDMapService &osdmap_service, - ceph::net::Messenger &cluster_msgr, - ceph::net::Messenger &public_msgr, - ceph::mon::Client &monc, - ceph::mgr::Client &mgrc, - ceph::os::FuturizedStore &store); + crimson::net::Messenger &cluster_msgr, + crimson::net::Messenger &public_msgr, + crimson::mon::Client &monc, + crimson::mgr::Client &mgrc, + crimson::os::FuturizedStore &store); seastar::future<> send_to_osd( int peer, MessageRef m, epoch_t from_epoch); - ceph::os::FuturizedStore &get_store() { + crimson::os::FuturizedStore &get_store() { return store; } @@ -98,7 +98,7 @@ public: /// Dispatch and reset ctx transaction seastar::future<> dispatch_context_transaction( - ceph::os::CollectionRef col, PeeringCtx &ctx); + crimson::os::CollectionRef col, PeeringCtx &ctx); /// Dispatch and reset ctx messages seastar::future<> dispatch_context_messages( @@ -106,7 +106,7 @@ public: /// Dispatch ctx and dispose of context seastar::future<> dispatch_context( - ceph::os::CollectionRef col, + crimson::os::CollectionRef col, PeeringCtx &&ctx); /// Dispatch ctx and dispose of ctx, transaction must be empty @@ -160,5 +160,4 @@ public: std::map<int, HeartbeatStampsRef> heartbeat_stamps; }; - } diff --git a/src/crimson/thread/Condition.h b/src/crimson/thread/Condition.h index 2a5c643d4a1..1d95048218b 100644 --- a/src/crimson/thread/Condition.h +++ b/src/crimson/thread/Condition.h @@ -6,7 +6,7 @@ #include <seastar/core/reactor.hh> #include <sys/eventfd.h> -namespace ceph::thread { +namespace crimson::thread { /// a synchronization primitive can be used to block a seastar thread, until /// another thread notifies it. @@ -33,4 +33,4 @@ public: } }; -} // namespace ceph::thread +} // namespace crimson::thread diff --git a/src/crimson/thread/ThreadPool.cc b/src/crimson/thread/ThreadPool.cc index 9df849b54c7..b4caaab2b57 100644 --- a/src/crimson/thread/ThreadPool.cc +++ b/src/crimson/thread/ThreadPool.cc @@ -6,7 +6,7 @@ #include "include/ceph_assert.h" -namespace ceph::thread { +namespace crimson::thread { ThreadPool::ThreadPool(size_t n_threads, size_t queue_sz, @@ -46,7 +46,7 @@ void ThreadPool::loop() { std::unique_lock lock{mutex}; cond.wait_for(lock, - ceph::net::conf.threadpool_empty_queue_max_wait, + crimson::net::conf.threadpool_empty_queue_max_wait, [this, &work_item] { return pending.pop(work_item) || is_stopping(); }); @@ -73,4 +73,4 @@ seastar::future<> ThreadPool::stop() }); } -} // namespace ceph::thread +} // namespace crimson::thread diff --git a/src/crimson/thread/ThreadPool.h b/src/crimson/thread/ThreadPool.h index cfd72d2a40d..dbc52388217 100644 --- a/src/crimson/thread/ThreadPool.h +++ b/src/crimson/thread/ThreadPool.h @@ -15,7 +15,7 @@ #include "Condition.h" -namespace ceph::thread { +namespace crimson::thread { struct WorkItem { virtual ~WorkItem() {} @@ -26,7 +26,7 @@ template<typename Func, typename T = std::invoke_result_t<Func>> struct Task final : WorkItem { Func func; seastar::future_state<T> state; - ceph::thread::Condition on_done; + crimson::thread::Condition on_done; public: explicit Task(Func&& f) : func(std::move(f)) @@ -84,7 +84,7 @@ public: * multiple of the number of cores. * @param n_threads the number of threads in this thread pool. * @param cpu the CPU core to which this thread pool is assigned - * @note each @c Task has its own ceph::thread::Condition, which possesses + * @note each @c Task has its own crimson::thread::Condition, which possesses * possesses an fd, so we should keep the size of queue under a reasonable * limit. */ @@ -115,4 +115,4 @@ public: } }; -} // namespace ceph::thread +} // namespace crimson::thread diff --git a/src/crimson/thread/Throttle.cc b/src/crimson/thread/Throttle.cc index 1d67e723174..99be02fa658 100644 --- a/src/crimson/thread/Throttle.cc +++ b/src/crimson/thread/Throttle.cc @@ -1,6 +1,6 @@ #include "Throttle.h" -namespace ceph::thread { +namespace crimson::thread { int64_t Throttle::take(int64_t c) { @@ -56,4 +56,4 @@ bool Throttle::_should_wait(size_t c) const { (c >= max && count > max)); // except for large c } -} // namespace ceph::thread::seastar +} // namespace crimson::thread diff --git a/src/crimson/thread/Throttle.h b/src/crimson/thread/Throttle.h index 51f4589ea50..117924b2e94 100644 --- a/src/crimson/thread/Throttle.h +++ b/src/crimson/thread/Throttle.h @@ -10,7 +10,7 @@ #include "common/ThrottleInterface.h" -namespace ceph::thread { +namespace crimson::thread { class Throttle final : public ThrottleInterface { size_t max = 0; @@ -36,4 +36,4 @@ private: bool _should_wait(size_t c) const; }; -} // namespace ceph::thread +} // namespace crimson::thread diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index c4f0607f945..6157d827a8f 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -707,7 +707,7 @@ future<> MonMap::init_with_dns_srv(bool for_mkfs, const std::string& name) }); } -seastar::future<> MonMap::build_monmap(const ceph::common::ConfigProxy& conf, +seastar::future<> MonMap::build_monmap(const crimson::common::ConfigProxy& conf, bool for_mkfs) { // -m foo? @@ -741,7 +741,7 @@ seastar::future<> MonMap::build_monmap(const ceph::common::ConfigProxy& conf, }); } -future<> MonMap::build_initial(const ceph::common::ConfigProxy& conf, bool for_mkfs) +future<> MonMap::build_initial(const crimson::common::ConfigProxy& conf, bool for_mkfs) { // file? if (const auto monmap = conf.get_val<std::string>("monmap"); diff --git a/src/mon/MonMap.h b/src/mon/MonMap.h index 0432b4e83d5..a149b44ca8b 100644 --- a/src/mon/MonMap.h +++ b/src/mon/MonMap.h @@ -426,7 +426,7 @@ public: * @param errout std::ostream to send error messages too */ #ifdef WITH_SEASTAR - seastar::future<> build_initial(const ceph::common::ConfigProxy& conf, bool for_mkfs); + seastar::future<> build_initial(const crimson::common::ConfigProxy& conf, bool for_mkfs); #else int build_initial(CephContext *cct, bool for_mkfs, std::ostream& errout); #endif @@ -485,7 +485,7 @@ protected: seastar::future<> read_monmap(const std::string& monmap); /// try to build monmap with different settings, like /// mon_host, mon* sections, and mon_dns_srv_name - seastar::future<> build_monmap(const ceph::common::ConfigProxy& conf, bool for_mkfs); + seastar::future<> build_monmap(const crimson::common::ConfigProxy& conf, bool for_mkfs); /// initialize monmap by resolving given service name seastar::future<> init_with_dns_srv(bool for_mkfs, const std::string& name); #else diff --git a/src/msg/Message.h b/src/msg/Message.h index e9b0fec7cab..4097b3eab43 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -235,7 +235,7 @@ class Message : public RefCountedObject { public: #ifdef WITH_SEASTAR - using ConnectionRef = ceph::net::ConnectionRef; + using ConnectionRef = crimson::net::ConnectionRef; #else using ConnectionRef = ::ConnectionRef; #endif // WITH_SEASTAR diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index c63f8c28b9d..a3b87915262 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -1587,8 +1587,8 @@ public: #ifdef WITH_SEASTAR seastar::future<> read_log_and_missing_crimson( - ceph::os::FuturizedStore &store, - ceph::os::CollectionRef ch, + crimson::os::FuturizedStore &store, + crimson::os::CollectionRef ch, const pg_info_t &info, ghobject_t pgmeta_oid ) { @@ -1600,8 +1600,8 @@ public: template <typename missing_type> struct FuturizedStoreLogReader { - ceph::os::FuturizedStore &store; - ceph::os::CollectionRef ch; + crimson::os::FuturizedStore &store; + crimson::os::CollectionRef ch; const pg_info_t &info; IndexedLog &log; missing_type &missing; @@ -1674,7 +1674,7 @@ public: [this]() { return store.omap_get_values(ch, pgmeta_oid, next).then( [this]( - bool done, ceph::os::FuturizedStore::omap_values_t values) { + bool done, crimson::os::FuturizedStore::omap_values_t values) { for (auto &&p : values) { process_entry(p); } @@ -1696,8 +1696,8 @@ public: template <typename missing_type> static seastar::future<> read_log_and_missing_crimson( - ceph::os::FuturizedStore &store, - ceph::os::CollectionRef ch, + crimson::os::FuturizedStore &store, + crimson::os::CollectionRef ch, const pg_info_t &info, IndexedLog &log, missing_type &missing, diff --git a/src/test/crimson/perf_crimson_msgr.cc b/src/test/crimson/perf_crimson_msgr.cc index d44d1f30462..e66f8702fb3 100644 --- a/src/test/crimson/perf_crimson_msgr.cc +++ b/src/test/crimson/perf_crimson_msgr.cc @@ -29,7 +29,7 @@ template<typename Message> using Ref = boost::intrusive_ptr<Message>; seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_ms); + return crimson::get_logger(ceph_subsys_ms); } enum class perf_mode_t { @@ -115,10 +115,10 @@ static seastar::future<> run( { struct test_state { struct Server final - : public ceph::net::Dispatcher, + : public crimson::net::Dispatcher, public seastar::peering_sharded_service<Server> { - ceph::net::Messenger *msgr = nullptr; - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::net::Messenger *msgr = nullptr; + crimson::auth::DummyAuthClientServer dummy_auth; const seastar::shard_id sid; const seastar::shard_id msgr_sid; std::string lname; @@ -140,7 +140,7 @@ static seastar::future<> run( seastar::future<> stop() { return seastar::make_ready_future<>(); } - seastar::future<> ms_dispatch(ceph::net::Connection* c, + seastar::future<> ms_dispatch(crimson::net::Connection* c, MessageRef m) override { ceph_assert(m->get_type() == CEPH_MSG_OSD_OP); @@ -160,13 +160,13 @@ static seastar::future<> run( seastar::future<> init(bool v1_crc_enabled, const entity_addr_t& addr) { return container().invoke_on(msgr_sid, [v1_crc_enabled, addr] (auto& server) { // server msgr is always with nonce 0 - auto&& fut = ceph::net::Messenger::create(entity_name_t::OSD(server.sid), server.lname, 0, server.sid); + auto&& fut = crimson::net::Messenger::create(entity_name_t::OSD(server.sid), server.lname, 0, server.sid); return fut.then( - [&server, addr, v1_crc_enabled](ceph::net::Messenger *messenger) { + [&server, addr, v1_crc_enabled](crimson::net::Messenger *messenger) { return server.container().invoke_on_all( [messenger, v1_crc_enabled](auto& server) { server.msgr = messenger->get_local_shard(); - server.msgr->set_default_policy(ceph::net::SocketPolicy::stateless_server(0)); + server.msgr->set_default_policy(crimson::net::SocketPolicy::stateless_server(0)); server.msgr->set_auth_client(&server.dummy_auth); server.msgr->set_auth_server(&server.dummy_auth); if (v1_crc_enabled) { @@ -191,7 +191,7 @@ static seastar::future<> run( }; struct Client final - : public ceph::net::Dispatcher, + : public crimson::net::Dispatcher, public seastar::peering_sharded_service<Client> { struct ConnStats { @@ -250,16 +250,16 @@ static seastar::future<> run( std::string lname; const unsigned jobs; - ceph::net::Messenger *msgr = nullptr; + crimson::net::Messenger *msgr = nullptr; const unsigned msg_len; bufferlist msg_data; const unsigned nr_depth; seastar::semaphore depth; std::vector<mono_time> time_msgs_sent; - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::auth::DummyAuthClientServer dummy_auth; unsigned sent_count = 0u; - ceph::net::ConnectionRef active_conn = nullptr; + crimson::net::ConnectionRef active_conn = nullptr; bool stop_send = false; seastar::promise<> stopped_send_promise; @@ -287,11 +287,11 @@ static seastar::future<> run( seastar::future<> stop() { return seastar::now(); } - seastar::future<> ms_handle_connect(ceph::net::ConnectionRef conn) override { + seastar::future<> ms_handle_connect(crimson::net::ConnectionRef conn) override { conn_stats.connected_time = mono_clock::now(); return seastar::now(); } - seastar::future<> ms_dispatch(ceph::net::Connection* c, + seastar::future<> ms_dispatch(crimson::net::Connection* c, MessageRef m) override { // server replies with MOSDOp to generate server-side write workload ceph_assert(m->get_type() == CEPH_MSG_OSD_OP); @@ -323,10 +323,10 @@ static seastar::future<> run( seastar::future<> init(bool v1_crc_enabled) { return container().invoke_on_all([v1_crc_enabled] (auto& client) { if (client.is_active()) { - return ceph::net::Messenger::create(entity_name_t::OSD(client.sid), client.lname, client.sid, client.sid) - .then([&client, v1_crc_enabled] (ceph::net::Messenger *messenger) { + return crimson::net::Messenger::create(entity_name_t::OSD(client.sid), client.lname, client.sid, client.sid) + .then([&client, v1_crc_enabled] (crimson::net::Messenger *messenger) { client.msgr = messenger; - client.msgr->set_default_policy(ceph::net::SocketPolicy::lossy_client(0)); + client.msgr->set_default_policy(crimson::net::SocketPolicy::lossy_client(0)); client.msgr->set_require_authorizer(false); client.msgr->set_auth_client(&client.dummy_auth); client.msgr->set_auth_server(&client.dummy_auth); @@ -564,7 +564,7 @@ static seastar::future<> run( } private: - seastar::future<> send_msg(ceph::net::Connection* conn) { + seastar::future<> send_msg(crimson::net::Connection* conn) { ceph_assert(seastar::engine().cpu_id() == sid); return depth.wait(1).then([this, conn] { const static pg_t pgid; @@ -597,7 +597,7 @@ static seastar::future<> run( return stopped_send_promise.get_future(); } - void do_dispatch_messages(ceph::net::Connection* conn) { + void do_dispatch_messages(crimson::net::Connection* conn) { ceph_assert(seastar::engine().cpu_id() == sid); ceph_assert(sent_count == 0); conn_stats.start_time = mono_clock::now(); @@ -638,9 +638,9 @@ static seastar::future<> run( }; return seastar::when_all_succeed( - ceph::net::create_sharded<test_state::Server>(server_conf.core, server_conf.block_size), - ceph::net::create_sharded<test_state::Client>(client_conf.jobs, - client_conf.block_size, client_conf.depth)) + crimson::net::create_sharded<test_state::Server>(server_conf.core, server_conf.block_size), + crimson::net::create_sharded<test_state::Client>(client_conf.jobs, + client_conf.block_size, client_conf.depth)) .then([=](test_state::Server *server, test_state::Client *client) { if (mode == perf_mode_t::both) { diff --git a/src/test/crimson/test_alien_echo.cc b/src/test/crimson/test_alien_echo.cc index a35c617380a..b7e6ab4b7f3 100644 --- a/src/test/crimson/test_alien_echo.cc +++ b/src/test/crimson/test_alien_echo.cc @@ -36,13 +36,13 @@ struct DummyAuthAuthorizer : public AuthAuthorizer { }; struct Server { - ceph::thread::Throttle byte_throttler; - ceph::net::Messenger& msgr; - ceph::auth::DummyAuthClientServer dummy_auth; - struct ServerDispatcher : ceph::net::Dispatcher { + crimson::thread::Throttle byte_throttler; + crimson::net::Messenger& msgr; + crimson::auth::DummyAuthClientServer dummy_auth; + struct ServerDispatcher : crimson::net::Dispatcher { unsigned count = 0; seastar::condition_variable on_reply; - seastar::future<> ms_dispatch(ceph::net::Connection* c, + seastar::future<> ms_dispatch(crimson::net::Connection* c, MessageRef m) override { std::cout << "server got ping " << *m << std::endl; // reply with a pong @@ -59,8 +59,8 @@ struct Server { 0, bufferlist{}); } } dispatcher; - Server(ceph::net::Messenger& msgr) - : byte_throttler(ceph::net::conf.osd_client_message_size_cap), + Server(crimson::net::Messenger& msgr) + : byte_throttler(crimson::net::conf.osd_client_message_size_cap), msgr{msgr} { msgr.set_crc_header(); @@ -69,13 +69,13 @@ struct Server { }; struct Client { - ceph::thread::Throttle byte_throttler; - ceph::net::Messenger& msgr; - ceph::auth::DummyAuthClientServer dummy_auth; - struct ClientDispatcher : ceph::net::Dispatcher { + crimson::thread::Throttle byte_throttler; + crimson::net::Messenger& msgr; + crimson::auth::DummyAuthClientServer dummy_auth; + struct ClientDispatcher : crimson::net::Dispatcher { unsigned count = 0; seastar::condition_variable on_reply; - seastar::future<> ms_dispatch(ceph::net::Connection* c, + seastar::future<> ms_dispatch(crimson::net::Connection* c, MessageRef m) override { std::cout << "client got pong " << *m << std::endl; ++count; @@ -83,8 +83,8 @@ struct Client { return seastar::now(); } } dispatcher; - Client(ceph::net::Messenger& msgr) - : byte_throttler(ceph::net::conf.osd_client_message_size_cap), + Client(crimson::net::Messenger& msgr) + : byte_throttler(crimson::net::conf.osd_client_message_size_cap), msgr{msgr} { msgr.set_crc_header(); @@ -95,7 +95,7 @@ struct Client { class SeastarContext { seastar::file_desc begin_fd; - ceph::thread::Condition on_end; + crimson::thread::Condition on_end; public: SeastarContext() @@ -151,14 +151,14 @@ seastar_echo(const entity_addr_t addr, echo_role role, unsigned count) { std::cout << "seastar/"; if (role == echo_role::as_server) { - return ceph::net::Messenger::create(entity_name_t::OSD(0), "server", + return crimson::net::Messenger::create(entity_name_t::OSD(0), "server", addr.get_nonce(), 0) .then([addr, count] (auto msgr) { return seastar::do_with(seastar_pingpong::Server{*msgr}, [addr, count](auto& server) mutable { std::cout << "server listening at " << addr << std::endl; // bind the server - server.msgr.set_default_policy(ceph::net::SocketPolicy::stateless_server(0)); + server.msgr.set_default_policy(crimson::net::SocketPolicy::stateless_server(0)); server.msgr.set_policy_throttler(entity_name_t::TYPE_OSD, &server.byte_throttler); server.msgr.set_require_authorizer(false); @@ -178,13 +178,13 @@ seastar_echo(const entity_addr_t addr, echo_role role, unsigned count) }); }); } else { - return ceph::net::Messenger::create(entity_name_t::OSD(1), "client", + return crimson::net::Messenger::create(entity_name_t::OSD(1), "client", addr.get_nonce(), 0) .then([addr, count] (auto msgr) { return seastar::do_with(seastar_pingpong::Client{*msgr}, [addr, count](auto& client) { std::cout << "client sending to " << addr << std::endl; - client.msgr.set_default_policy(ceph::net::SocketPolicy::lossy_client(0)); + client.msgr.set_default_policy(crimson::net::SocketPolicy::lossy_client(0)); client.msgr.set_policy_throttler(entity_name_t::TYPE_OSD, &client.byte_throttler); client.msgr.set_require_authorizer(false); @@ -193,7 +193,7 @@ seastar_echo(const entity_addr_t addr, echo_role role, unsigned count) return client.msgr.start(&client.dispatcher) .then([addr, &client] { return client.msgr.connect(addr, entity_name_t::TYPE_OSD); - }).then([&disp=client.dispatcher, count](ceph::net::ConnectionXRef conn) { + }).then([&disp=client.dispatcher, count](crimson::net::ConnectionXRef conn) { return seastar::do_until( [&disp,count] { return disp.count >= count; }, [&disp,conn] { return (*conn)->send(make_message<MPing>()) diff --git a/src/test/crimson/test_config.cc b/src/test/crimson/test_config.cc index 35b258f6e97..29f6f9a7f3f 100644 --- a/src/test/crimson/test_config.cc +++ b/src/test/crimson/test_config.cc @@ -7,7 +7,7 @@ #include "common/config_obs.h" #include "crimson/common/config_proxy.h" -using Config = ceph::common::ConfigProxy; +using Config = crimson::common::ConfigProxy; const std::string test_uint_option = "osd_max_pgls"; const uint64_t INVALID_VALUE = (uint64_t)(-1); @@ -31,13 +31,13 @@ class ConfigObs : public ceph::md_config_obs_impl<Config> { } public: ConfigObs() { - ceph::common::local_conf().add_observer(this); + crimson::common::local_conf().add_observer(this); } uint64_t get_last_change() const { return last_change; } uint64_t get_num_changes() const { return num_changes; } seastar::future<> stop() { - ceph::common::local_conf().remove_observer(this); + crimson::common::local_conf().remove_observer(this); return seastar::now(); } }; @@ -46,7 +46,7 @@ seastar::sharded<ConfigObs> sharded_cobs; static seastar::future<> test_config() { - return ceph::common::sharded_conf().start(EntityName{}, string_view{"ceph"}).then([] { + return crimson::common::sharded_conf().start(EntityName{}, string_view{"ceph"}).then([] { std::vector<const char*> args; std::string cluster; std::string conf_file_list; @@ -54,22 +54,22 @@ static seastar::future<> test_config() CEPH_ENTITY_TYPE_CLIENT, &cluster, &conf_file_list); - auto& conf = ceph::common::local_conf(); + auto& conf = crimson::common::local_conf(); conf->name = init_params.name; conf->cluster = cluster; return conf.parse_config_files(conf_file_list); }).then([] { - return ceph::common::sharded_conf().invoke_on(0, &Config::start); + return crimson::common::sharded_conf().invoke_on(0, &Config::start); }).then([] { return sharded_cobs.start(); }).then([] { - return ceph::common::sharded_conf().invoke_on_all([](Config& config) { + return crimson::common::sharded_conf().invoke_on_all([](Config& config) { return config.set_val(test_uint_option, std::to_string(seastar::engine().cpu_id())); }); }).then([] { - auto expected = ceph::common::local_conf().get_val<uint64_t>(test_uint_option); - return ceph::common::sharded_conf().invoke_on_all([expected](Config& config) { + auto expected = crimson::common::local_conf().get_val<uint64_t>(test_uint_option); + return crimson::common::sharded_conf().invoke_on_all([expected](Config& config) { if (expected != config.get_val<uint64_t>(test_uint_option)) { throw std::runtime_error("configurations don't match"); } @@ -83,7 +83,7 @@ static seastar::future<> test_config() }).finally([] { return sharded_cobs.stop(); }).finally([] { - return ceph::common::sharded_conf().stop(); + return crimson::common::sharded_conf().stop(); }); } diff --git a/src/test/crimson/test_messenger.cc b/src/test/crimson/test_messenger.cc index 3cda5930dd5..484c8fc5ddf 100644 --- a/src/test/crimson/test_messenger.cc +++ b/src/test/crimson/test_messenger.cc @@ -28,7 +28,7 @@ namespace bpo = boost::program_options; namespace { seastar::logger& logger() { - return ceph::get_logger(ceph_subsys_ms); + return crimson::get_logger(ceph_subsys_ms); } static std::random_device rd; @@ -41,10 +41,10 @@ static seastar::future<> test_echo(unsigned rounds, { struct test_state { struct Server final - : public ceph::net::Dispatcher, + : public crimson::net::Dispatcher, public seastar::peering_sharded_service<Server> { - ceph::net::Messenger *msgr = nullptr; - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::net::Messenger *msgr = nullptr; + crimson::auth::DummyAuthClientServer dummy_auth; Dispatcher* get_local_shard() override { return &(container().local()); @@ -52,7 +52,7 @@ static seastar::future<> test_echo(unsigned rounds, seastar::future<> stop() { return seastar::make_ready_future<>(); } - seastar::future<> ms_dispatch(ceph::net::Connection* c, + seastar::future<> ms_dispatch(crimson::net::Connection* c, MessageRef m) override { if (verbose) { logger().info("server got {}", *m); @@ -65,11 +65,11 @@ static seastar::future<> test_echo(unsigned rounds, const std::string& lname, const uint64_t nonce, const entity_addr_t& addr) { - auto&& fut = ceph::net::Messenger::create(name, lname, nonce); - return fut.then([this, addr](ceph::net::Messenger *messenger) { + auto&& fut = crimson::net::Messenger::create(name, lname, nonce); + return fut.then([this, addr](crimson::net::Messenger *messenger) { return container().invoke_on_all([messenger](auto& server) { server.msgr = messenger->get_local_shard(); - server.msgr->set_default_policy(ceph::net::SocketPolicy::stateless_server(0)); + server.msgr->set_default_policy(crimson::net::SocketPolicy::stateless_server(0)); server.msgr->set_require_authorizer(false); server.msgr->set_auth_client(&server.dummy_auth); server.msgr->set_auth_server(&server.dummy_auth); @@ -87,7 +87,7 @@ static seastar::future<> test_echo(unsigned rounds, }; struct Client final - : public ceph::net::Dispatcher, + : public crimson::net::Dispatcher, public seastar::peering_sharded_service<Client> { struct PingSession : public seastar::enable_shared_from_this<PingSession> { @@ -99,16 +99,16 @@ static seastar::future<> test_echo(unsigned rounds, unsigned rounds; std::bernoulli_distribution keepalive_dist; - ceph::net::Messenger *msgr = nullptr; - std::map<ceph::net::Connection*, seastar::promise<>> pending_conns; - std::map<ceph::net::Connection*, PingSessionRef> sessions; - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::net::Messenger *msgr = nullptr; + std::map<crimson::net::Connection*, seastar::promise<>> pending_conns; + std::map<crimson::net::Connection*, PingSessionRef> sessions; + crimson::auth::DummyAuthClientServer dummy_auth; Client(unsigned rounds, double keepalive_ratio) : rounds(rounds), keepalive_dist(std::bernoulli_distribution{keepalive_ratio}) {} - PingSessionRef find_session(ceph::net::Connection* c) { + PingSessionRef find_session(crimson::net::Connection* c) { auto found = sessions.find(c); if (found == sessions.end()) { ceph_assert(false); @@ -122,7 +122,7 @@ static seastar::future<> test_echo(unsigned rounds, seastar::future<> stop() { return seastar::now(); } - seastar::future<> ms_handle_connect(ceph::net::ConnectionRef conn) override { + seastar::future<> ms_handle_connect(crimson::net::ConnectionRef conn) override { auto session = seastar::make_shared<PingSession>(); auto [i, added] = sessions.emplace(conn.get(), session); std::ignore = i; @@ -130,7 +130,7 @@ static seastar::future<> test_echo(unsigned rounds, session->connected_time = mono_clock::now(); return seastar::now(); } - seastar::future<> ms_dispatch(ceph::net::Connection* c, + seastar::future<> ms_dispatch(crimson::net::Connection* c, MessageRef m) override { auto session = find_session(c); ++(session->count); @@ -154,11 +154,11 @@ static seastar::future<> test_echo(unsigned rounds, seastar::future<> init(const entity_name_t& name, const std::string& lname, const uint64_t nonce) { - return ceph::net::Messenger::create(name, lname, nonce) - .then([this](ceph::net::Messenger *messenger) { + return crimson::net::Messenger::create(name, lname, nonce) + .then([this](crimson::net::Messenger *messenger) { return container().invoke_on_all([messenger](auto& client) { client.msgr = messenger->get_local_shard(); - client.msgr->set_default_policy(ceph::net::SocketPolicy::lossy_client(0)); + client.msgr->set_default_policy(crimson::net::SocketPolicy::lossy_client(0)); client.msgr->set_auth_client(&client.dummy_auth); client.msgr->set_auth_server(&client.dummy_auth); }).then([this, messenger] { @@ -208,7 +208,7 @@ static seastar::future<> test_echo(unsigned rounds, } private: - seastar::future<> do_dispatch_pingpong(ceph::net::Connection* conn) { + seastar::future<> do_dispatch_pingpong(crimson::net::Connection* conn) { return container().invoke_on_all([conn](auto& client) { auto [i, added] = client.pending_conns.emplace(conn, seastar::promise<>()); std::ignore = i; @@ -256,10 +256,10 @@ static seastar::future<> test_echo(unsigned rounds, logger().info("test_echo(rounds={}, keepalive_ratio={}, v2={}):", rounds, keepalive_ratio, v2); return seastar::when_all_succeed( - ceph::net::create_sharded<test_state::Server>(), - ceph::net::create_sharded<test_state::Server>(), - ceph::net::create_sharded<test_state::Client>(rounds, keepalive_ratio), - ceph::net::create_sharded<test_state::Client>(rounds, keepalive_ratio)) + crimson::net::create_sharded<test_state::Server>(), + crimson::net::create_sharded<test_state::Server>(), + crimson::net::create_sharded<test_state::Client>(rounds, keepalive_ratio), + crimson::net::create_sharded<test_state::Client>(rounds, keepalive_ratio)) .then([rounds, keepalive_ratio, v2](test_state::Server *server1, test_state::Server *server2, test_state::Client *client1, @@ -316,15 +316,15 @@ static seastar::future<> test_concurrent_dispatch(bool v2) { struct test_state { struct Server final - : public ceph::net::Dispatcher, + : public crimson::net::Dispatcher, public seastar::peering_sharded_service<Server> { - ceph::net::Messenger *msgr = nullptr; + crimson::net::Messenger *msgr = nullptr; int count = 0; seastar::promise<> on_second; // satisfied on second dispatch seastar::promise<> on_done; // satisfied when first dispatch unblocks - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::auth::DummyAuthClientServer dummy_auth; - seastar::future<> ms_dispatch(ceph::net::Connection* c, + seastar::future<> ms_dispatch(crimson::net::Connection* c, MessageRef m) override { switch (++count) { case 1: @@ -349,11 +349,11 @@ static seastar::future<> test_concurrent_dispatch(bool v2) const std::string& lname, const uint64_t nonce, const entity_addr_t& addr) { - return ceph::net::Messenger::create(name, lname, nonce, 0) - .then([this, addr](ceph::net::Messenger *messenger) { + return crimson::net::Messenger::create(name, lname, nonce, 0) + .then([this, addr](crimson::net::Messenger *messenger) { return container().invoke_on_all([messenger](auto& server) { server.msgr = messenger->get_local_shard(); - server.msgr->set_default_policy(ceph::net::SocketPolicy::stateless_server(0)); + server.msgr->set_default_policy(crimson::net::SocketPolicy::stateless_server(0)); server.msgr->set_auth_client(&server.dummy_auth); server.msgr->set_auth_server(&server.dummy_auth); }).then([messenger, addr] { @@ -373,19 +373,19 @@ static seastar::future<> test_concurrent_dispatch(bool v2) }; struct Client final - : public ceph::net::Dispatcher, + : public crimson::net::Dispatcher, public seastar::peering_sharded_service<Client> { - ceph::net::Messenger *msgr = nullptr; - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::net::Messenger *msgr = nullptr; + crimson::auth::DummyAuthClientServer dummy_auth; seastar::future<> init(const entity_name_t& name, const std::string& lname, const uint64_t nonce) { - return ceph::net::Messenger::create(name, lname, nonce, 0) - .then([this](ceph::net::Messenger *messenger) { + return crimson::net::Messenger::create(name, lname, nonce, 0) + .then([this](crimson::net::Messenger *messenger) { return container().invoke_on_all([messenger](auto& client) { client.msgr = messenger->get_local_shard(); - client.msgr->set_default_policy(ceph::net::SocketPolicy::lossy_client(0)); + client.msgr->set_default_policy(crimson::net::SocketPolicy::lossy_client(0)); client.msgr->set_auth_client(&client.dummy_auth); client.msgr->set_auth_server(&client.dummy_auth); }).then([this, messenger] { @@ -405,8 +405,8 @@ static seastar::future<> test_concurrent_dispatch(bool v2) logger().info("test_concurrent_dispatch(v2={}):", v2); return seastar::when_all_succeed( - ceph::net::create_sharded<test_state::Server>(), - ceph::net::create_sharded<test_state::Client>()) + crimson::net::create_sharded<test_state::Server>(), + crimson::net::create_sharded<test_state::Client>()) .then([v2](test_state::Server *server, test_state::Client *client) { entity_addr_t addr; @@ -423,7 +423,7 @@ static seastar::future<> test_concurrent_dispatch(bool v2) .then([server, client] { return client->msgr->connect(server->msgr->get_myaddr(), entity_name_t::TYPE_OSD); - }).then([](ceph::net::ConnectionXRef conn) { + }).then([](crimson::net::ConnectionXRef conn) { // send two messages return (*conn)->send(make_message<MPing>()).then([conn] { return (*conn)->send(make_message<MPing>()); @@ -445,12 +445,12 @@ static seastar::future<> test_concurrent_dispatch(bool v2) seastar::future<> test_preemptive_shutdown(bool v2) { struct test_state { class Server final - : public ceph::net::Dispatcher, + : public crimson::net::Dispatcher, public seastar::peering_sharded_service<Server> { - ceph::net::Messenger *msgr = nullptr; - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::net::Messenger *msgr = nullptr; + crimson::auth::DummyAuthClientServer dummy_auth; - seastar::future<> ms_dispatch(ceph::net::Connection* c, + seastar::future<> ms_dispatch(crimson::net::Connection* c, MessageRef m) override { return c->send(make_message<MPing>()); } @@ -460,11 +460,11 @@ seastar::future<> test_preemptive_shutdown(bool v2) { const std::string& lname, const uint64_t nonce, const entity_addr_t& addr) { - return ceph::net::Messenger::create(name, lname, nonce, seastar::engine().cpu_id() - ).then([this, addr](ceph::net::Messenger *messenger) { + return crimson::net::Messenger::create(name, lname, nonce, seastar::engine().cpu_id() + ).then([this, addr](crimson::net::Messenger *messenger) { return container().invoke_on_all([messenger](auto& server) { server.msgr = messenger->get_local_shard(); - server.msgr->set_default_policy(ceph::net::SocketPolicy::stateless_server(0)); + server.msgr->set_default_policy(crimson::net::SocketPolicy::stateless_server(0)); server.msgr->set_auth_client(&server.dummy_auth); server.msgr->set_auth_server(&server.dummy_auth); }).then([messenger, addr] { @@ -489,15 +489,15 @@ seastar::future<> test_preemptive_shutdown(bool v2) { }; class Client final - : public ceph::net::Dispatcher, + : public crimson::net::Dispatcher, public seastar::peering_sharded_service<Client> { - ceph::net::Messenger *msgr = nullptr; - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::net::Messenger *msgr = nullptr; + crimson::auth::DummyAuthClientServer dummy_auth; bool stop_send = false; seastar::promise<> stopped_send_promise; - seastar::future<> ms_dispatch(ceph::net::Connection* c, + seastar::future<> ms_dispatch(crimson::net::Connection* c, MessageRef m) override { return seastar::now(); } @@ -506,11 +506,11 @@ seastar::future<> test_preemptive_shutdown(bool v2) { seastar::future<> init(const entity_name_t& name, const std::string& lname, const uint64_t nonce) { - return ceph::net::Messenger::create(name, lname, nonce, seastar::engine().cpu_id() - ).then([this](ceph::net::Messenger *messenger) { + return crimson::net::Messenger::create(name, lname, nonce, seastar::engine().cpu_id() + ).then([this](crimson::net::Messenger *messenger) { return container().invoke_on_all([messenger](auto& client) { client.msgr = messenger->get_local_shard(); - client.msgr->set_default_policy(ceph::net::SocketPolicy::lossy_client(0)); + client.msgr->set_default_policy(crimson::net::SocketPolicy::lossy_client(0)); client.msgr->set_auth_client(&client.dummy_auth); client.msgr->set_auth_server(&client.dummy_auth); }).then([this, messenger] { @@ -520,7 +520,7 @@ seastar::future<> test_preemptive_shutdown(bool v2) { } seastar::future<> send_pings(const entity_addr_t& addr) { return msgr->connect(addr, entity_name_t::TYPE_OSD - ).then([this](ceph::net::ConnectionXRef conn) { + ).then([this](crimson::net::ConnectionXRef conn) { // forwarded to stopped_send_promise (void) seastar::do_until( [this] { return stop_send; }, @@ -551,8 +551,8 @@ seastar::future<> test_preemptive_shutdown(bool v2) { logger().info("test_preemptive_shutdown(v2={}):", v2); return seastar::when_all_succeed( - ceph::net::create_sharded<test_state::Server>(), - ceph::net::create_sharded<test_state::Client>() + crimson::net::create_sharded<test_state::Server>(), + crimson::net::create_sharded<test_state::Client>() ).then([v2](test_state::Server *server, test_state::Client *client) { entity_addr_t addr; @@ -583,17 +583,17 @@ seastar::future<> test_preemptive_shutdown(bool v2) { } using ceph::msgr::v2::Tag; -using ceph::net::bp_action_t; -using ceph::net::bp_type_t; -using ceph::net::Breakpoint; -using ceph::net::Connection; -using ceph::net::ConnectionRef; -using ceph::net::custom_bp_t; -using ceph::net::Dispatcher; -using ceph::net::Interceptor; -using ceph::net::Messenger; -using ceph::net::SocketPolicy; -using ceph::net::tag_bp_t; +using crimson::net::bp_action_t; +using crimson::net::bp_type_t; +using crimson::net::Breakpoint; +using crimson::net::Connection; +using crimson::net::ConnectionRef; +using crimson::net::custom_bp_t; +using crimson::net::Dispatcher; +using crimson::net::Interceptor; +using crimson::net::Messenger; +using crimson::net::SocketPolicy; +using crimson::net::tag_bp_t; struct counter_t { unsigned counter = 0; }; @@ -918,7 +918,7 @@ SocketPolicy to_socket_policy(policy_t policy) { } class FailoverSuite : public Dispatcher { - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::auth::DummyAuthClientServer dummy_auth; Messenger& test_msgr; const entity_addr_t test_peer_addr; TestInterceptor interceptor; @@ -1315,7 +1315,7 @@ class FailoverSuite : public Dispatcher { }; class FailoverTest : public Dispatcher { - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::auth::DummyAuthClientServer dummy_auth; Messenger& cmd_msgr; ConnectionRef cmd_conn; const entity_addr_t test_addr; @@ -1513,7 +1513,7 @@ class FailoverTest : public Dispatcher { class FailoverSuitePeer : public Dispatcher { using cb_t = std::function<seastar::future<>()>; - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::auth::DummyAuthClientServer dummy_auth; Messenger& peer_msgr; cb_t op_callback; @@ -1641,7 +1641,7 @@ class FailoverSuitePeer : public Dispatcher { }; class FailoverTestPeer : public Dispatcher { - ceph::auth::DummyAuthClientServer dummy_auth; + crimson::auth::DummyAuthClientServer dummy_auth; Messenger& cmd_msgr; ConnectionRef cmd_conn; std::unique_ptr<FailoverSuitePeer> test_suite; diff --git a/src/test/crimson/test_monc.cc b/src/test/crimson/test_monc.cc index fc3984f8119..a733d7de864 100644 --- a/src/test/crimson/test_monc.cc +++ b/src/test/crimson/test_monc.cc @@ -6,12 +6,12 @@ #include "crimson/net/Connection.h" #include "crimson/net/Messenger.h" -using Config = ceph::common::ConfigProxy; -using MonClient = ceph::mon::Client; +using Config = crimson::common::ConfigProxy; +using MonClient = crimson::mon::Client; namespace { -class DummyAuthHandler : public ceph::common::AuthHandler { +class DummyAuthHandler : public crimson::common::AuthHandler { public: void handle_authentication(const EntityName& name, const AuthCapsInfo& caps) final @@ -24,7 +24,7 @@ DummyAuthHandler dummy_handler; static seastar::future<> test_monc() { - return ceph::common::sharded_conf().start(EntityName{}, string_view{"ceph"}).then([] { + return crimson::common::sharded_conf().start(EntityName{}, string_view{"ceph"}).then([] { std::vector<const char*> args; std::string cluster; std::string conf_file_list; @@ -32,17 +32,17 @@ static seastar::future<> test_monc() CEPH_ENTITY_TYPE_CLIENT, &cluster, &conf_file_list); - auto& conf = ceph::common::local_conf(); + auto& conf = crimson::common::local_conf(); conf->name = init_params.name; conf->cluster = cluster; return conf.parse_config_files(conf_file_list); }).then([] { - return ceph::common::sharded_perf_coll().start(); + return crimson::common::sharded_perf_coll().start(); }).then([] { - return ceph::net::Messenger::create(entity_name_t::OSD(0), "monc", 0, + return crimson::net::Messenger::create(entity_name_t::OSD(0), "monc", 0, seastar::engine().cpu_id()) - .then([] (ceph::net::Messenger *msgr) { - auto& conf = ceph::common::local_conf(); + .then([] (crimson::net::Messenger *msgr) { + auto& conf = crimson::common::local_conf(); if (conf->ms_crc_data) { msgr->set_crc_data(); } @@ -64,8 +64,8 @@ static seastar::future<> test_monc() }); }); }).finally([] { - return ceph::common::sharded_perf_coll().stop().then([] { - return ceph::common::sharded_conf().stop(); + return crimson::common::sharded_perf_coll().stop().then([] { + return crimson::common::sharded_conf().stop(); }); }); } diff --git a/src/test/crimson/test_perfcounters.cc b/src/test/crimson/test_perfcounters.cc index d5c8bb8bb68..bd261dc1dad 100644 --- a/src/test/crimson/test_perfcounters.cc +++ b/src/test/crimson/test_perfcounters.cc @@ -19,8 +19,8 @@ enum { static constexpr uint64_t PERF_VAL = 42; static seastar::future<> test_perfcounters(){ - return ceph::common::sharded_perf_coll().start().then([] { - return ceph::common::sharded_perf_coll().invoke_on_all([] (auto& s){ + return crimson::common::sharded_perf_coll().start().then([] { + return crimson::common::sharded_perf_coll().invoke_on_all([] (auto& s){ std::string name =fmt::format("seastar-osd::shard-{}",seastar::engine().cpu_id()); PerfCountersBuilder plb(NULL, name, PERFTEST_FIRST,PERFTEST_LAST); plb.add_u64_counter(PERFTEST_INDEX, "perftest_count", "count perftest"); @@ -29,7 +29,7 @@ static seastar::future<> test_perfcounters(){ s.get_perf_collection()->add(perf_logger); }); }).then([]{ - return ceph::common::sharded_perf_coll().invoke_on_all([] (auto& s){ + return crimson::common::sharded_perf_coll().invoke_on_all([] (auto& s){ auto pcc = s.get_perf_collection(); pcc->with_counters([](auto& by_path){ for (auto& perf_counter : by_path) { @@ -40,7 +40,7 @@ static seastar::future<> test_perfcounters(){ }); }); }).finally([] { - return ceph::common::sharded_perf_coll().stop(); + return crimson::common::sharded_perf_coll().stop(); }); } diff --git a/src/test/crimson/test_socket.cc b/src/test/crimson/test_socket.cc index adb16eebe34..56bc5037b6f 100644 --- a/src/test/crimson/test_socket.cc +++ b/src/test/crimson/test_socket.cc @@ -14,10 +14,10 @@ namespace { using seastar::future; -using ceph::net::error; -using ceph::net::Socket; -using ceph::net::SocketFRef; -using ceph::net::stop_t; +using crimson::net::error; +using crimson::net::Socket; +using crimson::net::SocketFRef; +using crimson::net::stop_t; static seastar::logger logger{"crimsontest"}; @@ -127,12 +127,12 @@ future<> test_refused() { future<> test_bind_same() { logger.info("test_bind_same()..."); - return ceph::net::create_sharded<AcceptTest>( + return crimson::net::create_sharded<AcceptTest>( ).then([] (AcceptTest* factory) { return factory->bind_accept( ).then([] { // try to bind the same address - return ceph::net::create_sharded<AcceptTest>( + return crimson::net::create_sharded<AcceptTest>( ).then([] (AcceptTest* factory2) { return factory2->bind_accept( ).then([] { @@ -158,7 +158,7 @@ future<> test_bind_same() { future<> test_accept() { logger.info("test_accept()"); - return ceph::net::create_sharded<AcceptTest>( + return crimson::net::create_sharded<AcceptTest>( ).then([] (AcceptTest* factory) { return factory->bind_accept().then([factory] { return seastar::when_all( @@ -205,7 +205,7 @@ class SocketFactory final } static future<SocketFRef, SocketFRef> get_sockets() { - return ceph::net::create_sharded<SocketFactory>(seastar::engine().cpu_id() + return crimson::net::create_sharded<SocketFactory>(seastar::engine().cpu_id() ).then([] (SocketFactory* factory) { return factory->bind_accept().then([factory] { return connect(); diff --git a/src/test/crimson/test_thread_pool.cc b/src/test/crimson/test_thread_pool.cc index 61e714456e4..ede6ea1ebe0 100644 --- a/src/test/crimson/test_thread_pool.cc +++ b/src/test/crimson/test_thread_pool.cc @@ -5,7 +5,7 @@ #include "crimson/thread/ThreadPool.h" using namespace std::chrono_literals; -using ThreadPool = ceph::thread::ThreadPool; +using ThreadPool = crimson::thread::ThreadPool; seastar::future<> test_accumulate(ThreadPool& tp) { static constexpr auto N = 5; |