diff options
author | Shinobu Kinjo <shinobu@redhat.com> | 2017-12-04 12:00:02 +0100 |
---|---|---|
committer | Shinobu Kinjo <shinobu@redhat.com> | 2017-12-09 04:42:32 +0100 |
commit | fb50bde049dd1b6bc54aa256925945c3aa301538 (patch) | |
tree | 4f1354c4e5aaf414aeb5d70795e8da1aa8f832de /src/journal/Journaler.cc | |
parent | Merge pull request #19196 from shun-s/wip-cephdisk-fix-major-error (diff) | |
download | ceph-fb50bde049dd1b6bc54aa256925945c3aa301538.tar.xz ceph-fb50bde049dd1b6bc54aa256925945c3aa301538.zip |
journal: Trivial cleanup
Signed-off-by: Shinobu Kinjo <shinobu@redhat.com>
Diffstat (limited to 'src/journal/Journaler.cc')
-rw-r--r-- | src/journal/Journaler.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/journal/Journaler.cc b/src/journal/Journaler.cc index a138c7c0810..d9517f0621c 100644 --- a/src/journal/Journaler.cc +++ b/src/journal/Journaler.cc @@ -60,12 +60,15 @@ Journaler::Threads::~Threads() { timer->shutdown(); } delete timer; + timer = nullptr; work_queue->drain(); delete work_queue; + work_queue = nullptr; thread_pool->stop(); delete thread_pool; + thread_pool = nullptr; } Journaler::Journaler(librados::IoCtx &header_ioctx, @@ -118,15 +121,16 @@ Journaler::~Journaler() { assert(m_recorder == nullptr); delete m_threads; + m_threads = nullptr; } void Journaler::exists(Context *on_finish) const { librados::ObjectReadOperation op; - op.stat(NULL, NULL, NULL); + op.stat(nullptr, nullptr, nullptr); librados::AioCompletion *comp = librados::Rados::aio_create_completion(on_finish, nullptr, rados_ctx_callback); - int r = m_header_ioctx.aio_operate(m_header_oid, comp, &op, NULL); + int r = m_header_ioctx.aio_operate(m_header_oid, comp, &op, nullptr); assert(r == 0); comp->release(); } @@ -171,6 +175,7 @@ void Journaler::shut_down(Context *on_finish) { assert(m_recorder == nullptr); JournalMetadata *metadata = nullptr; + assert(m_metadata != nullptr); std::swap(metadata, m_metadata); assert(metadata != nullptr); @@ -181,7 +186,7 @@ void Journaler::shut_down(Context *on_finish) { JournalTrimmer *trimmer = nullptr; std::swap(trimmer, m_trimmer); - if (trimmer == nullptr) { + if (!trimmer) { metadata->shut_down(on_finish); return; } @@ -343,7 +348,7 @@ void Journaler::start_live_replay(ReplayHandler *replay_handler, bool Journaler::try_pop_front(ReplayEntry *replay_entry, uint64_t *tag_tid) { - assert(m_player != NULL); + assert(m_player != nullptr); Entry entry; uint64_t commit_tid; @@ -366,6 +371,7 @@ void Journaler::stop_replay() { void Journaler::stop_replay(Context *on_finish) { JournalPlayer *player = nullptr; + assert(m_player != nullptr); std::swap(player, m_player); assert(player != nullptr); @@ -387,7 +393,7 @@ void Journaler::committed(const Future &future) { void Journaler::start_append(int flush_interval, uint64_t flush_bytes, double flush_age) { - assert(m_recorder == NULL); + assert(m_recorder == nullptr); // TODO verify active object set >= current replay object set @@ -398,6 +404,7 @@ void Journaler::start_append(int flush_interval, uint64_t flush_bytes, void Journaler::stop_append(Context *on_safe) { JournalRecorder *recorder = nullptr; + assert(m_recorder != nullptr); std::swap(recorder, m_recorder); assert(recorder != nullptr); @@ -427,14 +434,14 @@ void Journaler::flush_append(Context *on_safe) { } void Journaler::create_player(ReplayHandler *replay_handler) { - assert(m_player == NULL); + assert(m_player == nullptr); m_player = new JournalPlayer(m_data_ioctx, m_object_oid_prefix, m_metadata, replay_handler); } void Journaler::get_metadata(uint8_t *order, uint8_t *splay_width, int64_t *pool_id) { - assert(m_metadata != NULL); + assert(m_metadata != nullptr); *order = m_metadata->get_order(); *splay_width = m_metadata->get_splay_width(); @@ -444,7 +451,7 @@ void Journaler::get_metadata(uint8_t *order, uint8_t *splay_width, std::ostream &operator<<(std::ostream &os, const Journaler &journaler) { os << "[metadata="; - if (journaler.m_metadata != NULL) { + if (journaler.m_metadata) { os << *journaler.m_metadata; } else { os << "NULL"; |