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_IMAGE_CLOSE_REQUEST_H
5 #define CEPH_LIBRBD_IMAGE_CLOSE_REQUEST_H
7 #include "librbd/ImageCtx.h"
17 template <typename ImageCtxT = ImageCtx>
20 static CloseRequest *create(ImageCtxT *image_ctx, Context *on_finish) {
21 return new CloseRequest(image_ctx, on_finish);
33 * BLOCK_IMAGE_WATCHER (skip if R/O)
36 * SHUT_DOWN_UPDATE_WATCHERS
39 * SHUT_DOWN_AIO_WORK_QUEUE . . .
40 * | . (exclusive lock disabled)
42 * SHUT_DOWN_EXCLUSIVE_LOCK FLUSH
44 * | . . . . . . . . . . .
47 * UNREGISTER_IMAGE_WATCHER (skip if R/O)
56 * FLUSH_OP_WORK_QUEUE . . . . .
59 * CLOSE_PARENT . (no parent)
62 * FLUSH_IMAGE_WATCHER < . . . .
70 CloseRequest(ImageCtxT *image_ctx, Context *on_finish);
72 ImageCtxT *m_image_ctx;
77 decltype(m_image_ctx->exclusive_lock) m_exclusive_lock;
79 void send_block_image_watcher();
80 void handle_block_image_watcher(int r);
82 void send_shut_down_update_watchers();
83 void handle_shut_down_update_watchers(int r);
85 void send_shut_down_io_queue();
86 void handle_shut_down_io_queue(int r);
88 void send_shut_down_exclusive_lock();
89 void handle_shut_down_exclusive_lock(int r);
92 void handle_flush(int r);
94 void send_unregister_image_watcher();
95 void handle_unregister_image_watcher(int r);
97 void send_flush_readahead();
98 void handle_flush_readahead(int r);
100 void send_shut_down_cache();
101 void handle_shut_down_cache(int r);
103 void send_flush_op_work_queue();
104 void handle_flush_op_work_queue(int r);
106 void send_close_parent();
107 void handle_close_parent(int r);
109 void send_flush_image_watcher();
110 void handle_flush_image_watcher(int r);
114 void save_result(int result) {
115 if (m_error_result == 0 && result < 0) {
116 m_error_result = result;
122 } // namespace librbd
124 extern template class librbd::image::CloseRequest<librbd::ImageCtx>;
126 #endif // CEPH_LIBRBD_IMAGE_CLOSE_REQUEST_H