1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_LIBRBD_EXCLUSIVE_LOCK_POST_ACQUIRE_REQUEST_H
5 #define CEPH_LIBRBD_EXCLUSIVE_LOCK_POST_ACQUIRE_REQUEST_H
7 #include "include/int_types.h"
8 #include "include/buffer.h"
9 #include "librbd/ImageCtx.h"
10 #include "msg/msg_types.h"
17 namespace exclusive_lock {
19 template <typename ImageCtxT = ImageCtx>
20 class PostAcquireRequest {
22 static PostAcquireRequest* create(ImageCtxT &image_ctx, Context *on_acquire,
25 ~PostAcquireRequest();
37 * REFRESH (skip if not
40 * OPEN_OBJECT_MAP (skip if
43 * OPEN_JOURNAL (skip if
48 * ALLOCATE_JOURNAL_TAG *
58 * <finish> <----------/
63 PostAcquireRequest(ImageCtxT &image_ctx, Context *on_acquire,
66 ImageCtxT &m_image_ctx;
67 Context *m_on_acquire;
70 decltype(m_image_ctx.object_map) m_object_map;
71 decltype(m_image_ctx.journal) m_journal;
73 bool m_prepare_lock_completed = false;
77 void handle_refresh(int r);
79 void send_open_journal();
80 void handle_open_journal(int r);
82 void send_allocate_journal_tag();
83 void handle_allocate_journal_tag(int r);
85 void send_open_object_map();
86 void handle_open_object_map(int r);
88 void send_close_journal();
89 void handle_close_journal(int r);
91 void send_close_object_map();
92 void handle_close_object_map(int r);
99 void save_result(int result) {
100 if (m_error_result == 0 && result < 0) {
101 m_error_result = result;
106 } // namespace exclusive_lock
107 } // namespace librbd
109 extern template class librbd::exclusive_lock::PostAcquireRequest<librbd::ImageCtx>;
111 #endif // CEPH_LIBRBD_EXCLUSIVE_LOCK_POST_ACQUIRE_REQUEST_H