]> git.proxmox.com Git - ceph.git/blame - ceph/src/librbd/cache/pwl/ssd/LogEntry.h
import ceph 16.2.7
[ceph.git] / ceph / src / librbd / cache / pwl / ssd / LogEntry.h
CommitLineData
f67539c2
TL
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_PWL_SSD_LOG_ENTRY_H
5#define CEPH_LIBRBD_CACHE_PWL_SSD_LOG_ENTRY_H
6
7#include "librbd/cache/pwl/LogEntry.h"
8
9namespace librbd {
10namespace cache {
11class ImageWritebackInterface;
12namespace pwl {
13namespace ssd {
14
15class WriteLogEntry : public pwl::WriteLogEntry {
16public:
17 WriteLogEntry(
18 std::shared_ptr<SyncPointLogEntry> sync_point_entry,
19 uint64_t image_offset_bytes, uint64_t write_bytes)
20 : pwl::WriteLogEntry(sync_point_entry, image_offset_bytes, write_bytes) {}
21 WriteLogEntry(
22 uint64_t image_offset_bytes, uint64_t write_bytes)
23 : pwl::WriteLogEntry(image_offset_bytes, write_bytes) {}
24 WriteLogEntry(
25 std::shared_ptr<SyncPointLogEntry> sync_point_entry,
26 uint64_t image_offset_bytes, uint64_t write_bytes,
27 uint32_t data_length)
28 : pwl::WriteLogEntry(sync_point_entry, image_offset_bytes,
29 write_bytes, data_length) {}
30 WriteLogEntry(
31 uint64_t image_offset_bytes, uint64_t write_bytes,
32 uint32_t data_length)
33 : pwl::WriteLogEntry(image_offset_bytes, write_bytes, data_length) {}
34 ~WriteLogEntry() {}
35 WriteLogEntry(const WriteLogEntry&) = delete;
36 WriteLogEntry &operator=(const WriteLogEntry&) = delete;
37 void writeback_bl(librbd::cache::ImageWritebackInterface &image_writeback,
38 Context *ctx, ceph::bufferlist &&bl) override;
39 void init_cache_bl(bufferlist &src_bl, uint64_t off, uint64_t len) override;
40 buffer::list &get_cache_bl() override;
a4b75251 41 void copy_cache_bl(bufferlist *out) override;
f67539c2
TL
42 void remove_cache_bl() override;
43 unsigned int get_aligned_data_size() const override;
a4b75251
TL
44 void inc_bl_refs() { bl_refs++; };
45 void dec_bl_refs() { bl_refs--; };
46 unsigned int reader_count() const override {
47 return bl_refs;
48 }
f67539c2
TL
49};
50
51class WriteSameLogEntry : public WriteLogEntry {
52public:
53 WriteSameLogEntry(
54 std::shared_ptr<SyncPointLogEntry> sync_point_entry,
55 uint64_t image_offset_bytes, uint64_t write_bytes,
56 uint32_t data_length)
57 : WriteLogEntry(sync_point_entry, image_offset_bytes,
58 write_bytes, data_length) {}
59 WriteSameLogEntry(
60 uint64_t image_offset_bytes, uint64_t write_bytes,
61 uint32_t data_length)
62 : WriteLogEntry(image_offset_bytes, write_bytes, data_length) {}
63 ~WriteSameLogEntry() {}
64 WriteSameLogEntry(const WriteSameLogEntry&) = delete;
65 WriteSameLogEntry &operator=(const WriteSameLogEntry&) = delete;
66 void writeback_bl(librbd::cache::ImageWritebackInterface &image_writeback,
67 Context *ctx, ceph::bufferlist &&bl) override;
68};
69
70} // namespace ssd
71} // namespace pwl
72} // namespace cache
73} // namespace librbd
74
75#endif // CEPH_LIBRBD_CACHE_PWL_SSD_LOG_ENTRY_H