void ImageState<I>::refresh(Context *on_finish) {
CephContext *cct = m_image_ctx->cct;
ldout(cct, 20) << __func__ << dendl;
- refresh(false, on_finish);
-}
-
-template <typename I>
-void ImageState<I>::acquire_lock_refresh(Context *on_finish) {
- CephContext *cct = m_image_ctx->cct;
- ldout(cct, 20) << __func__ << dendl;
- refresh(true, on_finish);
-}
-
-template <typename I>
-void ImageState<I>::refresh(bool acquiring_lock, Context *on_finish) {
m_lock.Lock();
if (is_closed()) {
Action action(ACTION_TYPE_REFRESH);
action.refresh_seq = m_refresh_seq;
- action.refresh_acquiring_lock = acquiring_lock;
execute_action_unlock(action, on_finish);
}
*m_image_ctx, create_context_callback<
ImageState<I>, &ImageState<I>::handle_refresh>(this));
image::RefreshRequest<I> *req = image::RefreshRequest<I>::create(
- *m_image_ctx, action_context.refresh_acquiring_lock, ctx);
+ *m_image_ctx, false, ctx);
m_lock.Unlock();
req->send();
int refresh();
int refresh_if_required();
void refresh(Context *on_finish);
- void acquire_lock_refresh(Context *on_finish);
void snap_set(const std::string &snap_name, Context *on_finish);
struct Action {
ActionType action_type;
uint64_t refresh_seq = 0;
- bool refresh_acquiring_lock = false;
std::string snap_name;
Context *on_ready = nullptr;
}
switch (action_type) {
case ACTION_TYPE_REFRESH:
- return (refresh_seq == action.refresh_seq &&
- refresh_acquiring_lock == action.refresh_acquiring_lock);
+ return (refresh_seq == action.refresh_seq);
case ACTION_TYPE_SET_SNAP:
return snap_name == action.snap_name;
case ACTION_TYPE_LOCK:
bool is_transition_state() const;
bool is_closed() const;
- void refresh(bool acquiring_lock, Context *on_finish);
-
void append_context(const Action &action, Context *context);
void execute_next_action_unlock();
void execute_action_unlock(const Action &action, Context *context);
struct MockImageState {
MOCK_CONST_METHOD0(is_refresh_required, bool());
MOCK_METHOD1(refresh, void(Context*));
- MOCK_METHOD1(acquire_lock_refresh, void(Context*));
MOCK_METHOD1(open, void(Context*));