1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "librbd/journal/Utils.h"
5 #include "common/dout.h"
6 #include "common/errno.h"
7 #include "librbd/journal/Types.h"
9 #define dout_subsys ceph_subsys_rbd
11 #define dout_prefix *_dout << "librbd::journal::"
17 int C_DecodeTag::decode(bufferlist::iterator *it, TagData *tag_data) {
19 ::decode(*tag_data, *it);
20 } catch (const buffer::error &err) {
26 int C_DecodeTag::process(int r) {
28 lderr(cct) << "C_DecodeTag: " << this << " " << __func__ << ": "
29 << "failed to allocate tag: " << cpp_strerror(r)
34 Mutex::Locker locker(*lock);
37 bufferlist::iterator data_it = tag.data.begin();
38 r = decode(&data_it, tag_data);
40 lderr(cct) << "C_DecodeTag: " << this << " " << __func__ << ": "
41 << "failed to decode allocated tag" << dendl;
45 ldout(cct, 20) << "C_DecodeTag: " << this << " " << __func__ << ": "
46 << "allocated journal tag: "
47 << "tid=" << tag.tid << ", "
48 << "data=" << *tag_data << dendl;
52 int C_DecodeTags::process(int r) {
54 lderr(cct) << "C_DecodeTags: " << this << " " << __func__ << ": "
55 << "failed to retrieve journal tags: " << cpp_strerror(r)
61 lderr(cct) << "C_DecodeTags: " << this << " " << __func__ << ": "
62 << "no journal tags retrieved" << dendl;
66 Mutex::Locker locker(*lock);
67 *tag_tid = tags.back().tid;
68 bufferlist::iterator data_it = tags.back().data.begin();
69 r = C_DecodeTag::decode(&data_it, tag_data);
71 lderr(cct) << "C_DecodeTags: " << this << " " << __func__ << ": "
72 << "failed to decode journal tag" << dendl;
76 ldout(cct, 20) << "C_DecodeTags: " << this << " " << __func__ << ": "
77 << "most recent journal tag: "
78 << "tid=" << *tag_tid << ", "
79 << "data=" << *tag_data << dendl;
84 } // namespace journal