]> git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/cache/ImageWriteback.h
update sources to v12.1.2
[ceph.git] / ceph / src / librbd / cache / ImageWriteback.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_LIBRBD_CACHE_IMAGE_WRITEBACK
5 #define CEPH_LIBRBD_CACHE_IMAGE_WRITEBACK
6
7 #include "include/buffer_fwd.h"
8 #include "include/int_types.h"
9 #include <vector>
10
11 class Context;
12
13 namespace librbd {
14
15 struct ImageCtx;
16
17 namespace cache {
18
19 /**
20 * client-side, image extent cache writeback handler
21 */
22 template <typename ImageCtxT = librbd::ImageCtx>
23 class ImageWriteback {
24 public:
25 typedef std::vector<std::pair<uint64_t,uint64_t> > Extents;
26
27 ImageWriteback(ImageCtxT &image_ctx);
28
29 void aio_read(Extents &&image_extents, ceph::bufferlist *bl,
30 int fadvise_flags, Context *on_finish);
31 void aio_write(Extents &&image_extents, ceph::bufferlist&& bl,
32 int fadvise_flags, Context *on_finish);
33 void aio_discard(uint64_t offset, uint64_t length,
34 bool skip_partial_discard, Context *on_finish);
35 void aio_flush(Context *on_finish);
36 void aio_writesame(uint64_t offset, uint64_t length,
37 ceph::bufferlist&& bl,
38 int fadvise_flags, Context *on_finish);
39 void aio_compare_and_write(Extents &&image_extents,
40 ceph::bufferlist&& cmp_bl,
41 ceph::bufferlist&& bl,
42 uint64_t *mismatch_offset,
43 int fadvise_flags, Context *on_finish);
44 private:
45 ImageCtxT &m_image_ctx;
46
47 };
48
49 } // namespace cache
50 } // namespace librbd
51
52 extern template class librbd::cache::ImageWriteback<librbd::ImageCtx>;
53
54 #endif // CEPH_LIBRBD_CACHE_IMAGE_WRITEBACK