]> git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/cache/rwl/SyncPoint.h
bump version to 15.2.11-pve1
[ceph.git] / ceph / src / librbd / cache / rwl / SyncPoint.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_LIBRBD_CACHE_RWL_SYNC_POINT_H
5 #define CEPH_LIBRBD_CACHE_RWL_SYNC_POINT_H
6
7 #include "librbd/ImageCtx.h"
8 #include "librbd/cache/rwl/LogEntry.h"
9 #include "librbd/cache/rwl/Types.h"
10
11 namespace librbd {
12 namespace cache {
13 namespace rwl {
14
15 class SyncPoint {
16 public:
17 std::shared_ptr<SyncPointLogEntry> log_entry;
18 /* Use lock for earlier/later links */
19 std::shared_ptr<SyncPoint> earlier_sync_point; /* NULL if earlier has completed */
20 std::shared_ptr<SyncPoint> later_sync_point;
21 uint64_t final_op_sequence_num = 0;
22 /* A sync point can't appear in the log until all the writes bearing
23 * it and all the prior sync points have been appended and
24 * persisted.
25 *
26 * Writes bearing this sync gen number and the prior sync point will be
27 * sub-ops of this Gather. This sync point will not be appended until all
28 * these complete to the point where their persist order is guaranteed. */
29 C_Gather *prior_log_entries_persisted;
30 int prior_log_entries_persisted_result = 0;
31 int prior_log_entries_persisted_complete = false;
32 /* The finisher for this will append the sync point to the log. The finisher
33 * for m_prior_log_entries_persisted will be a sub-op of this. */
34 C_Gather *sync_point_persist;
35 bool append_scheduled = false;
36 bool appending = false;
37 /* Signal these when this sync point is appending to the log, and its order
38 * of appearance is guaranteed. One of these is is a sub-operation of the
39 * next sync point's m_prior_log_entries_persisted Gather. */
40 std::vector<Context*> on_sync_point_appending;
41 /* Signal these when this sync point is appended and persisted. User
42 * aio_flush() calls are added to this. */
43 std::vector<Context*> on_sync_point_persisted;
44
45 SyncPoint(uint64_t sync_gen_num, CephContext *cct);
46 ~SyncPoint();
47 SyncPoint(const SyncPoint&) = delete;
48 SyncPoint &operator=(const SyncPoint&) = delete;
49
50 private:
51 CephContext *m_cct;
52 friend std::ostream &operator<<(std::ostream &os,
53 const SyncPoint &p);
54 };
55
56 } // namespace rwl
57 } // namespace cache
58 } // namespace librbd
59
60 #endif // CEPH_LIBRBD_CACHE_RWL_SYNC_POINT_H