]>
git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/cache/PassthroughImageCache.h
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_CACHE_PASSTHROUGH_IMAGE_CACHE
5 #define CEPH_LIBRBD_CACHE_PASSTHROUGH_IMAGE_CACHE
7 #include "ImageCache.h"
8 #include "ImageWriteback.h"
17 * Example passthrough client-side, image extent cache
19 template <typename ImageCtxT
= librbd::ImageCtx
>
20 class PassthroughImageCache
: public ImageCache
{
22 PassthroughImageCache(ImageCtx
&image_ctx
);
24 /// client AIO methods
25 void aio_read(Extents
&& image_extents
, ceph::bufferlist
*bl
,
26 int fadvise_flags
, Context
*on_finish
) override
;
27 void aio_write(Extents
&& image_extents
, ceph::bufferlist
&& bl
,
28 int fadvise_flags
, Context
*on_finish
) override
;
29 void aio_discard(uint64_t offset
, uint64_t length
,
30 bool skip_partial_discard
, Context
*on_finish
);
31 void aio_flush(Context
*on_finish
) override
;
32 void aio_writesame(uint64_t offset
, uint64_t length
,
33 ceph::bufferlist
&& bl
,
34 int fadvise_flags
, Context
*on_finish
) override
;
35 void aio_compare_and_write(Extents
&& image_extents
,
36 ceph::bufferlist
&& cmp_bl
, ceph::bufferlist
&& bl
,
37 uint64_t *mismatch_offset
,int fadvise_flags
,
38 Context
*on_finish
) override
;
40 /// internal state methods
41 void init(Context
*on_finish
) override
;
42 void shut_down(Context
*on_finish
) override
;
44 void invalidate(Context
*on_finish
) override
;
45 void flush(Context
*on_finish
) override
;
48 ImageCtxT
&m_image_ctx
;
49 ImageWriteback
<ImageCtxT
> m_image_writeback
;
56 extern template class librbd::cache::PassthroughImageCache
<librbd::ImageCtx
>;
58 #endif // CEPH_LIBRBD_CACHE_PASSTHROUGH_IMAGE_CACHE