]>
Commit | Line | Data |
---|---|---|
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 | #pragma once | |
5 | ||
6 | #include <iostream> | |
7 | ||
8 | #include <boost/intrusive_ptr.hpp> | |
9 | #include <boost/smart_ptr/intrusive_ref_counter.hpp> | |
10 | #include <seastar/core/future.hh> | |
11 | ||
12 | #include "include/ceph_assert.h" | |
13 | #include "crimson/osd/exceptions.h" | |
14 | ||
15 | #include "crimson/os/seastore/extentmap_manager.h" | |
16 | #include "crimson/os/seastore/extentmap_manager/btree/extentmap_btree_node.h" | |
17 | #include "crimson/os/seastore/seastore_types.h" | |
18 | #include "crimson/os/seastore/transaction_manager.h" | |
19 | ||
20 | namespace crimson::os::seastore::extentmap_manager { | |
21 | /** | |
22 | * BtreeExtentMapManager | |
23 | * | |
24 | * Uses a btree to track : | |
25 | * objaddr_t -> laddr_t mapping for each onode extentmap | |
26 | */ | |
27 | ||
28 | class BtreeExtentMapManager : public ExtentMapManager { | |
29 | TransactionManager &tm; | |
30 | ||
31 | ext_context_t get_ext_context(Transaction &t) { | |
32 | return ext_context_t{tm,t}; | |
33 | } | |
34 | ||
35 | /* get_extmap_root | |
36 | * | |
37 | * load extent map tree root node | |
38 | */ | |
39 | using get_root_ertr = TransactionManager::read_extent_ertr; | |
40 | using get_root_ret = get_root_ertr::future<ExtMapNodeRef>; | |
41 | get_root_ret get_extmap_root(const extmap_root_t &extmap_root, Transaction &t); | |
42 | ||
43 | using insert_lextent_ertr = TransactionManager::read_extent_ertr; | |
44 | using insert_lextent_ret = insert_lextent_ertr::future<extent_mapping_t >; | |
45 | insert_lextent_ret insert_lextent(extmap_root_t &extmap_root, Transaction &t, | |
46 | ExtMapNodeRef extent, objaddr_t lo, | |
47 | lext_map_val_t val); | |
48 | ||
49 | public: | |
50 | explicit BtreeExtentMapManager(TransactionManager &tm); | |
51 | ||
52 | initialize_extmap_ret initialize_extmap(Transaction &t) final; | |
53 | ||
54 | find_lextent_ret find_lextent(const extmap_root_t &extmap_root, Transaction &t, objaddr_t lo, extent_len_t len) final; | |
55 | ||
56 | add_lextent_ret add_lextent(extmap_root_t &extmap_root, Transaction &t, objaddr_t lo, lext_map_val_t val) final; | |
57 | ||
58 | rm_lextent_ret rm_lextent(extmap_root_t &extmap_root, Transaction &t, objaddr_t lo, lext_map_val_t val) final; | |
59 | ||
60 | ||
61 | }; | |
62 | using BtreeExtentMapManagerRef = std::unique_ptr<BtreeExtentMapManager>; | |
63 | ||
64 | } |