]> git.proxmox.com Git - ceph.git/blame - ceph/src/crimson/tools/store_nbd/fs_driver.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / crimson / tools / store_nbd / fs_driver.h
CommitLineData
20effc67
TL
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3
4#include "block_driver.h"
5
6#include "crimson/os/futurized_collection.h"
7#include "crimson/os/futurized_store.h"
8
9class FSDriver final : public BlockDriver {
10public:
11 FSDriver(config_t config)
12 : config(config)
13 {}
14 ~FSDriver() final {}
15
16 bufferptr get_buffer(size_t size) final {
17 return ceph::buffer::create_page_aligned(size);
18 }
19
20 seastar::future<> write(
21 off_t offset,
22 bufferptr ptr) final;
23
24 seastar::future<bufferlist> read(
25 off_t offset,
26 size_t size) final;
27
28 size_t get_size() const {
29 return size;
30 }
31
32 seastar::future<> mount() final;
33
34 seastar::future<> close() final;
35
36private:
37 size_t size = 0;
38 const config_t config;
39 std::unique_ptr<crimson::os::FuturizedStore> fs;
1e59de90 40 crimson::os::FuturizedStore::Shard* sharded_fs;
20effc67
TL
41
42 struct pg_analogue_t {
43 crimson::os::CollectionRef collection;
44
45 ghobject_t log_object;
46 unsigned log_tail = 0;
47 unsigned log_head = 0;
48 };
49 std::map<unsigned, pg_analogue_t> collections;
50
51 struct offset_mapping_t {
52 pg_analogue_t &pg;
53 ghobject_t object;
54 off_t offset;
55 };
56 offset_mapping_t map_offset(off_t offset);
57
58 seastar::future<> mkfs();
59 seastar::future<> init();
60
61 friend void populate_log(
62 ceph::os::Transaction &,
63 pg_analogue_t &,
64 unsigned,
65 unsigned);
66
67 friend void update_log(
68 ceph::os::Transaction &,
69 FSDriver::pg_analogue_t &,
70 unsigned,
71 unsigned);
72};