]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #include "SyncPoint.h" | |
5 | ||
6 | #define dout_subsys ceph_subsys_rbd_rwl | |
7 | #undef dout_prefix | |
8 | #define dout_prefix *_dout << "librbd::cache::rwl::SyncPoint: " << this << " " \ | |
9 | << __func__ << ": " | |
10 | ||
11 | namespace librbd { | |
12 | namespace cache { | |
13 | namespace rwl { | |
14 | ||
15 | SyncPoint::SyncPoint(uint64_t sync_gen_num, CephContext *cct) | |
16 | : log_entry(std::make_shared<SyncPointLogEntry>(sync_gen_num)), m_cct(cct) { | |
17 | prior_log_entries_persisted = new C_Gather(cct, nullptr); | |
18 | sync_point_persist = new C_Gather(cct, nullptr); | |
19 | on_sync_point_appending.reserve(MAX_WRITES_PER_SYNC_POINT + 2); | |
20 | on_sync_point_persisted.reserve(MAX_WRITES_PER_SYNC_POINT + 2); | |
21 | ldout(m_cct, 20) << "sync point " << sync_gen_num << dendl; | |
22 | } | |
23 | ||
24 | SyncPoint::~SyncPoint() { | |
25 | ceph_assert(on_sync_point_appending.empty()); | |
26 | ceph_assert(on_sync_point_persisted.empty()); | |
27 | ceph_assert(!earlier_sync_point); | |
28 | } | |
29 | ||
30 | std::ostream &operator<<(std::ostream &os, | |
31 | const SyncPoint &p) { | |
32 | os << "log_entry=[" << *p.log_entry << "], " | |
33 | << "earlier_sync_point=" << p.earlier_sync_point << ", " | |
34 | << "later_sync_point=" << p.later_sync_point << ", " | |
35 | << "final_op_sequence_num=" << p.final_op_sequence_num << ", " | |
36 | << "prior_log_entries_persisted=" << p.prior_log_entries_persisted << ", " | |
37 | << "prior_log_entries_persisted_complete=" << p.prior_log_entries_persisted_complete << ", " | |
38 | << "append_scheduled=" << p.append_scheduled << ", " | |
39 | << "appending=" << p.appending << ", " | |
40 | << "on_sync_point_appending=" << p.on_sync_point_appending.size() << ", " | |
41 | << "on_sync_point_persisted=" << p.on_sync_point_persisted.size() << ""; | |
42 | return os; | |
43 | } | |
44 | ||
45 | } // namespace rwl | |
46 | } // namespace cache | |
47 | } // namespace librbd |