From b154f69b7931919d81e3aabe0ce837cc27907e4c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 16 Oct 2018 09:14:20 -0500 Subject: [PATCH] common/LogClient: Mutex -> ceph::mutex Signed-off-by: Sage Weil --- src/common/LogClient.cc | 22 +++++++++++----------- src/common/LogClient.h | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/common/LogClient.cc b/src/common/LogClient.cc index 7ae871484668c..951588ff44bf8 100644 --- a/src/common/LogClient.cc +++ b/src/common/LogClient.cc @@ -100,7 +100,7 @@ static ostream& _prefix(std::ostream *_dout, LogChannel *lc) { } LogChannel::LogChannel(CephContext *cct, LogClient *lc, const string &channel) - : cct(cct), parent(lc), channel_lock("LogChannel::channel_lock"), + : cct(cct), parent(lc), log_channel(channel), log_to_syslog(false), log_to_monitors(false) { } @@ -108,7 +108,7 @@ LogChannel::LogChannel(CephContext *cct, LogClient *lc, const string &channel) LogChannel::LogChannel(CephContext *cct, LogClient *lc, const string &channel, const string &facility, const string &prio) - : cct(cct), parent(lc), channel_lock("LogChannel::channel_lock"), + : cct(cct), parent(lc), log_channel(channel), log_prio(prio), syslog_facility(facility), log_to_syslog(false), log_to_monitors(false) { @@ -117,7 +117,7 @@ LogChannel::LogChannel(CephContext *cct, LogClient *lc, LogClient::LogClient(CephContext *cct, Messenger *m, MonMap *mm, enum logclient_flag_t flags) : cct(cct), messenger(m), monmap(mm), is_mon(flags & FLAG_MON), - log_lock("LogClient::log_lock"), last_log_sent(0), last_log(0) + last_log_sent(0), last_log(0) { } @@ -212,7 +212,7 @@ void LogChannel::do_log(clog_type prio, std::stringstream& ss) void LogChannel::do_log(clog_type prio, const std::string& s) { - std::lock_guard l(channel_lock); + std::lock_guard l(channel_lock); if (CLOG_ERROR == prio) { ldout(cct,-1) << "log " << prio << " : " << s << dendl; } else { @@ -250,7 +250,7 @@ void LogChannel::do_log(clog_type prio, const std::string& s) Message *LogClient::get_mon_log_message(bool flush) { - std::lock_guard l(log_lock); + std::lock_guard l(log_lock); if (flush) { if (log_queue.empty()) return nullptr; @@ -262,13 +262,13 @@ Message *LogClient::get_mon_log_message(bool flush) bool LogClient::are_pending() { - std::lock_guard l(log_lock); + std::lock_guard l(log_lock); return last_log > last_log_sent; } Message *LogClient::_get_mon_log_message() { - ceph_assert(log_lock.is_locked()); + ceph_assert(ceph_mutex_is_locked(log_lock)); if (log_queue.empty()) return NULL; @@ -314,7 +314,7 @@ Message *LogClient::_get_mon_log_message() void LogClient::_send_to_mon() { - ceph_assert(log_lock.is_locked()); + ceph_assert(ceph_mutex_is_locked(log_lock)); ceph_assert(is_mon); ceph_assert(messenger->get_myname().is_mon()); ldout(cct,10) << __func__ << " log to self" << dendl; @@ -324,7 +324,7 @@ void LogClient::_send_to_mon() version_t LogClient::queue(LogEntry &entry) { - std::lock_guard l(log_lock); + std::lock_guard l(log_lock); entry.seq = ++last_log; log_queue.push_back(entry); @@ -337,7 +337,7 @@ version_t LogClient::queue(LogEntry &entry) uint64_t LogClient::get_next_seq() { - std::lock_guard l(log_lock); + std::lock_guard l(log_lock); return ++last_log; } @@ -358,7 +358,7 @@ const EntityName& LogClient::get_myname() bool LogClient::handle_log_ack(MLogAck *m) { - std::lock_guard l(log_lock); + std::lock_guard l(log_lock); ldout(cct,10) << "handle_log_ack " << *m << dendl; version_t last = m->last; diff --git a/src/common/LogClient.h b/src/common/LogClient.h index 2241f9cb062cd..e138beac0b6e8 100644 --- a/src/common/LogClient.h +++ b/src/common/LogClient.h @@ -17,7 +17,7 @@ #include #include "common/LogEntry.h" -#include "common/Mutex.h" +#include "common/ceph_mutex.h" #include "include/health.h" class LogClient; @@ -192,7 +192,7 @@ public: private: CephContext *cct; LogClient *parent; - Mutex channel_lock; + ceph::mutex channel_lock = ceph::make_mutex("LogChannel::channel_lock"); std::string log_channel; std::string log_prio; std::string syslog_facility; @@ -262,7 +262,7 @@ private: Messenger *messenger; MonMap *monmap; bool is_mon; - Mutex log_lock; + ceph::mutex log_lock = ceph::make_mutex("LogClient::log_lock"); version_t last_log_sent; version_t last_log; std::deque log_queue; -- 2.39.5