diff --git a/src/librbd/Journal.cc b/src/librbd/Journal.cc index f9aff5bf23c..871abcf0a24 100644 --- a/src/librbd/Journal.cc +++ b/src/librbd/Journal.cc @@ -59,6 +59,10 @@ struct C_DecodeTag : public Context { lderr(cct) << "failed to decode allocated tag" << dendl; return r; } + + ldout(cct, 20) << "allocated journal tag: " + << "tid=" << tag.tid << ", " + << "data=" << *tag_data << dendl; return 0; } @@ -117,6 +121,10 @@ struct C_DecodeTags : public Context { lderr(cct) << "failed to decode journal tag" << dendl; return r; } + + ldout(cct, 20) << "most recent journal tag: " + << "tid=" << *tag_tid << ", " + << "data=" << *tag_data << dendl; return 0; } }; @@ -771,7 +779,7 @@ void Journal::handle_initialized(int r) { assert(m_state == STATE_INITIALIZING); if (r < 0) { - lderr(cct) << this << " " << __func__ + lderr(cct) << this << " " << __func__ << ": " << "failed to initialize journal: " << cpp_strerror(r) << dendl; destroy_journaler(r); @@ -808,6 +816,9 @@ void Journal::handle_initialized(int r) { } m_tag_class = image_client_meta->tag_class; + ldout(cct, 20) << "client: " << client << ", " + << "image meta: " << *image_client_meta << dendl; + C_DecodeTags *tags_ctx = new C_DecodeTags( cct, &m_lock, &m_tag_tid, &m_tag_data, create_async_context_callback( m_image_ctx, create_context_callback< diff --git a/src/librbd/journal/Types.cc b/src/librbd/journal/Types.cc index 2be074d267a..8da835eaf5f 100644 --- a/src/librbd/journal/Types.cc +++ b/src/librbd/journal/Types.cc @@ -478,11 +478,7 @@ void TagData::generate_test_instances(std::list &o) { o.push_back(new TagData("mirror-uuid", "remote-mirror-uuid", true, 123, 234)); } -} // namespace journal -} // namespace librbd - -std::ostream &operator<<(std::ostream &out, - const librbd::journal::EventType &type) { +std::ostream &operator<<(std::ostream &out, const EventType &type) { using namespace librbd::journal; switch (type) { @@ -532,8 +528,7 @@ std::ostream &operator<<(std::ostream &out, return out; } -std::ostream &operator<<(std::ostream &out, - const librbd::journal::ClientMetaType &type) { +std::ostream &operator<<(std::ostream &out, const ClientMetaType &type) { using namespace librbd::journal; switch (type) { @@ -551,5 +546,26 @@ std::ostream &operator<<(std::ostream &out, break; } return out; - } + +std::ostream &operator<<(std::ostream &out, const ImageClientMeta &meta) { + out << "[tag_class=" << meta.tag_class << "]"; + return out; +} + +std::ostream &operator<<(std::ostream &out, const TagData &tag_data) { + out << "[" + << "mirror_uuid=" << tag_data.mirror_uuid << ", " + << "predecessor_mirror_uuid=" << tag_data.predecessor_mirror_uuid; + if (tag_data.predecessor_commit_valid) { + out << ", " + << "predecessor_tag_tid=" << tag_data.predecessor_tag_tid << ", " + << "predecessor_entry_tid=" << tag_data.predecessor_entry_tid; + } + out << "]"; + return out; +} + +} // namespace journal +} // namespace librbd + diff --git a/src/librbd/journal/Types.h b/src/librbd/journal/Types.h index e355060065b..252ab776759 100644 --- a/src/librbd/journal/Types.h +++ b/src/librbd/journal/Types.h @@ -429,14 +429,14 @@ struct TagData { static void generate_test_instances(std::list &o); }; +std::ostream &operator<<(std::ostream &out, const EventType &type); +std::ostream &operator<<(std::ostream &out, const ClientMetaType &type); +std::ostream &operator<<(std::ostream &out, const ImageClientMeta &meta); +std::ostream &operator<<(std::ostream &out, const TagData &tag_data); + } // namespace journal } // namespace librbd -std::ostream &operator<<(std::ostream &out, - const librbd::journal::EventType &type); -std::ostream &operator<<(std::ostream &out, - const librbd::journal::ClientMetaType &type); - WRITE_CLASS_ENCODER(librbd::journal::EventEntry); WRITE_CLASS_ENCODER(librbd::journal::ClientData); WRITE_CLASS_ENCODER(librbd::journal::TagData);