librbd: improved debugging for journal client / tag processing

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2016-02-26 12:32:25 -05:00
parent 16d5e695c3
commit 8444da8480
3 changed files with 41 additions and 14 deletions

View File

@ -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<I>::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<I>::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<

View File

@ -478,11 +478,7 @@ void TagData::generate_test_instances(std::list<TagData *> &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

View File

@ -429,14 +429,14 @@ struct TagData {
static void generate_test_instances(std::list<TagData *> &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);