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_OBJECT_MAP_REFRESH_REQUEST_H
5 #define CEPH_LIBRBD_OBJECT_MAP_REFRESH_REQUEST_H
7 #include "include/int_types.h"
8 #include "include/buffer.h"
9 #include "common/bit_vector.hpp"
17 namespace object_map {
19 template <typename ImageCtxT = ImageCtx>
20 class RefreshRequest {
22 static RefreshRequest *create(ImageCtxT &image_ctx,
23 ceph::BitVector<2> *object_map,
24 uint64_t snap_id, Context *on_finish) {
25 return new RefreshRequest(image_ctx, object_map, snap_id, on_finish);
28 RefreshRequest(ImageCtxT &image_ctx, ceph::BitVector<2> *object_map,
29 uint64_t snap_id, Context *on_finish);
37 * <start> -----> LOCK (skip if snapshot)
40 * * LOAD * * * * * * * > INVALIDATE ------------\
42 * * | * (-EINVAL or too small) |
43 * * | * * * * * * > INVALIDATE_AND_RESIZE |
49 * * | | * * * * * * * |
52 * * \--------------------> LOCK <-------------/
55 * INVALIDATE_AND_CLOSE ---------------> <finish>
60 ImageCtxT &m_image_ctx;
61 ceph::BitVector<2> *m_object_map;
65 uint64_t m_object_count;
66 ceph::BitVector<2> m_on_disk_object_map;
67 bool m_truncate_on_disk_object_map;
71 Context *handle_lock(int *ret_val);
74 Context *handle_load(int *ret_val);
76 void send_invalidate();
77 Context *handle_invalidate(int *ret_val);
79 void send_resize_invalidate();
80 Context *handle_resize_invalidate(int *ret_val);
83 Context *handle_resize(int *ret_val);
85 void send_invalidate_and_close();
86 Context *handle_invalidate_and_close(int *ret_val);
91 } // namespace object_map
94 extern template class librbd::object_map::RefreshRequest<librbd::ImageCtx>;
96 #endif // CEPH_LIBRBD_OBJECT_MAP_REFRESH_REQUEST_H