From f31f9636a8a6de3bbacb3cefce98e8016d794769 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 23 Aug 2018 11:19:34 -0400 Subject: [PATCH] crimson: Use ceph_assert for asserts. Signed-off-by: Adam C. Emerson --- src/crimson/net/SocketConnection.cc | 14 +++++++------- src/crimson/net/SocketMessenger.cc | 8 ++++---- src/crimson/thread/ThreadPool.cc | 4 +++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index a9d8162ab5ca4..e7984223bbb9c 100644 --- a/src/crimson/net/SocketConnection.cc +++ b/src/crimson/net/SocketConnection.cc @@ -44,7 +44,7 @@ SocketConnection::SocketConnection(Messenger *messenger, SocketConnection::~SocketConnection() { // errors were reported to callers of send() - assert(send_ready.available()); + ceph_assert(send_ready.available()); send_ready.ignore_ready_future(); } @@ -245,12 +245,12 @@ bool SocketConnection::update_rx_seq(seq_num_t seq) if (seq <= in_seq) { if (HAVE_FEATURE(features, RECONNECT_SEQ) && conf.ms_die_on_old_message) { - assert(0 == "old msgs despite reconnect_seq feature"); + ceph_assert(0 == "old msgs despite reconnect_seq feature"); } return false; } else if (seq > in_seq + 1) { if (conf.ms_die_on_skipped_message) { - assert(0 == "skipped incoming seq"); + ceph_assert(0 == "skipped incoming seq"); } return false; } else { @@ -666,7 +666,7 @@ seastar::future<> SocketConnection::handle_connect_reply(msgr_tag_t tag) h.global_seq = get_messenger()->get_global_seq(h.reply.global_seq); return seastar::now(); case CEPH_MSGR_TAG_RETRY_SESSION: - assert(h.reply.connect_seq > h.connect_seq); + ceph_assert(h.reply.connect_seq > h.connect_seq); h.connect_seq = h.reply.connect_seq; return seastar::now(); case CEPH_MSGR_TAG_WAIT: @@ -773,7 +773,7 @@ seastar::future<> SocketConnection::connect(entity_type_t peer_type, }).then([this] (bufferlist bl) { auto p = bl.cbegin(); ::decode(h.reply, p); - assert(p.end()); + ceph_assert(p.end()); return read(h.reply.authorizer_len); }).then([this] (bufferlist bl) { if (h.authorizer) { @@ -797,7 +797,7 @@ seastar::future<> SocketConnection::client_handshake(entity_type_t peer_type, entity_addr_t saddr, caddr; ::decode(saddr, p); ::decode(caddr, p); - assert(p.end()); + ceph_assert(p.end()); validate_peer_addr(saddr, peer_addr); if (my_addr != caddr) { @@ -840,7 +840,7 @@ seastar::future<> SocketConnection::server_handshake() validate_banner(p); entity_addr_t addr; ::decode(addr, p); - assert(p.end()); + ceph_assert(p.end()); if (!addr.is_blank_ip()) { peer_addr = addr; } diff --git a/src/crimson/net/SocketMessenger.cc b/src/crimson/net/SocketMessenger.cc index 9fc6cb008a45a..f601d223f6cbe 100644 --- a/src/crimson/net/SocketMessenger.cc +++ b/src/crimson/net/SocketMessenger.cc @@ -43,7 +43,7 @@ seastar::future<> SocketMessenger::dispatch(ConnectionRef conn) { auto [i, added] = connections.emplace(conn->get_peer_addr(), conn); std::ignore = i; - assert(added); + ceph_assert(added); return seastar::repeat([=] { return conn->read_message() @@ -185,10 +185,10 @@ ceph::net::ConnectionRef SocketMessenger::lookup_conn(const entity_addr_t& addr) void SocketMessenger::unregister_conn(ConnectionRef conn) { - assert(conn); + ceph_assert(conn); auto found = connections.find(conn->get_peer_addr()); - assert(found != connections.end()); - assert(found->second == conn); + ceph_assert(found != connections.end()); + ceph_assert(found->second == conn); connections.erase(found); } diff --git a/src/crimson/thread/ThreadPool.cc b/src/crimson/thread/ThreadPool.cc index d1fb262c47762..0154344c212cc 100644 --- a/src/crimson/thread/ThreadPool.cc +++ b/src/crimson/thread/ThreadPool.cc @@ -4,6 +4,8 @@ #include "crimson/net/Config.h" #include "include/intarith.h" +#include "include/assert.h" + namespace ceph::thread { ThreadPool::ThreadPool(size_t n_threads, @@ -34,7 +36,7 @@ void ThreadPool::pin(unsigned cpu_id) CPU_SET(cpu_id, &cs); [[maybe_unused]] auto r = pthread_setaffinity_np(pthread_self(), sizeof(cs), &cs); - assert(r == 0); + ceph_assert(r == 0); } void ThreadPool::loop() -- 2.39.5