]> git.proxmox.com Git - ceph.git/blame - ceph/src/crimson/tools/store_nbd/fs_driver.h
import quincy beta 17.1.0
[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;
40
41 struct pg_analogue_t {
42 crimson::os::CollectionRef collection;
43
44 ghobject_t log_object;
45 unsigned log_tail = 0;
46 unsigned log_head = 0;
47 };
48 std::map<unsigned, pg_analogue_t> collections;
49
50 struct offset_mapping_t {
51 pg_analogue_t &pg;
52 ghobject_t object;
53 off_t offset;
54 };
55 offset_mapping_t map_offset(off_t offset);
56
57 seastar::future<> mkfs();
58 seastar::future<> init();
59
60 friend void populate_log(
61 ceph::os::Transaction &,
62 pg_analogue_t &,
63 unsigned,
64 unsigned);
65
66 friend void update_log(
67 ceph::os::Transaction &,
68 FSDriver::pg_analogue_t &,
69 unsigned,
70 unsigned);
71};