]>
git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/operation/DisableFeaturesRequest.h
623eb1f87dca6614eff6222ab73ad68ea5aa924e
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_OPERATION_DISABLE_FEATURES_REQUEST_H
5 #define CEPH_LIBRBD_OPERATION_DISABLE_FEATURES_REQUEST_H
7 #include "librbd/operation/Request.h"
8 #include "cls/rbd/cls_rbd_client.h"
18 template <typename ImageCtxT
= ImageCtx
>
19 class DisableFeaturesRequest
: public Request
<ImageCtxT
> {
21 static DisableFeaturesRequest
*create(ImageCtxT
&image_ctx
, Context
*on_finish
,
22 uint64_t journal_op_tid
,
23 uint64_t features
, bool force
) {
24 return new DisableFeaturesRequest(image_ctx
, on_finish
, journal_op_tid
,
28 DisableFeaturesRequest(ImageCtxT
&image_ctx
, Context
*on_finish
,
29 uint64_t journal_op_tid
, uint64_t features
, bool force
);
32 void send_op() override
;
33 bool should_complete(int r
) override
;
34 bool can_affect_io() const override
{
37 journal::Event
create_event(uint64_t op_tid
) const override
{
38 return journal::UpdateFeaturesEvent(op_tid
, m_features
, false);
43 * DisableFeatures goes through the following state machine:
56 * STATE_ACQUIRE_EXCLUSIVE_LOCK (skip if not
58 * | (disbling journaling)
59 * \-------------------\
62 * | STATE_GET_MIRROR_MODE
65 * | journaling) STATE_GET_MIRROR_IMAGE
68 * | STATE_DISABLE_MIRROR_IMAGE (skip if not
71 * | STATE_CLOSE_JOURNAL
74 * | STATE_REMOVE_JOURNAL
76 * |/-------------------/
79 * STATE_APPEND_OP_EVENT (skip if journaling
82 * STATE_REMOVE_OBJECT_MAP (skip if not
83 * | disabling object map)
94 * STATE_REALEASE_EXCLUSIVE_LOCK (skip if not
107 bool m_acquired_lock
= false;
108 bool m_writes_blocked
= false;
109 bool m_snap_lock_acquired
= false;
110 bool m_requests_blocked
= false;
112 uint64_t m_new_features
= 0;
113 uint64_t m_disable_flags
= 0;
114 uint64_t m_features_mask
= 0;
116 cls::rbd::MirrorMode m_mirror_mode
= cls::rbd::MIRROR_MODE_DISABLED
;
119 void send_prepare_lock();
120 Context
*handle_prepare_lock(int *result
);
122 void send_block_writes();
123 Context
*handle_block_writes(int *result
);
125 void send_acquire_exclusive_lock();
126 Context
*handle_acquire_exclusive_lock(int *result
);
128 void send_get_mirror_mode();
129 Context
*handle_get_mirror_mode(int *result
);
131 void send_get_mirror_image();
132 Context
*handle_get_mirror_image(int *result
);
134 void send_disable_mirror_image();
135 Context
*handle_disable_mirror_image(int *result
);
137 void send_close_journal();
138 Context
*handle_close_journal(int *result
);
140 void send_remove_journal();
141 Context
*handle_remove_journal(int *result
);
143 void send_append_op_event();
144 Context
*handle_append_op_event(int *result
);
146 void send_remove_object_map();
147 Context
*handle_remove_object_map(int *result
);
149 void send_set_features();
150 Context
*handle_set_features(int *result
);
152 void send_update_flags();
153 Context
*handle_update_flags(int *result
);
155 void send_notify_update();
156 Context
*handle_notify_update(int *result
);
158 void send_release_exclusive_lock();
159 Context
*handle_release_exclusive_lock(int *result
);
161 Context
*handle_finish(int r
);
164 } // namespace operation
165 } // namespace librbd
167 extern template class librbd::operation::DisableFeaturesRequest
<librbd::ImageCtx
>;
169 #endif // CEPH_LIBRBD_OPERATION_DISABLE_FEATURES_REQUEST_H