namespace crimson::os::seastore::onode {
+using eagain_ertr = crimson::errorator<
+ crimson::ct_error::eagain>;
+
using crimson::os::seastore::Transaction;
using crimson::os::seastore::TransactionRef;
using crimson::os::seastore::laddr_t;
using crimson::os::seastore::TransactionManager;
class NodeExtentManager {
+ using base_ertr = eagain_ertr::extend<
+ crimson::ct_error::input_output_error>;
+
public:
virtual ~NodeExtentManager() = default;
+
+ // TODO: remove the coarse-grained errorator
using tm_ertr = crimson::errorator<
crimson::ct_error::input_output_error,
crimson::ct_error::invarg,
crimson::ct_error::enoent,
crimson::ct_error::erange,
crimson::ct_error::eagain>;
- template <class ValueT=void>
- using tm_future = tm_ertr::future<ValueT>;
virtual bool is_read_isolated() const = 0;
- virtual tm_future<NodeExtentRef> read_extent(
+
+ using read_ertr = base_ertr::extend<
+ crimson::ct_error::invarg,
+ crimson::ct_error::enoent,
+ crimson::ct_error::erange>;
+ virtual read_ertr::future<NodeExtentRef> read_extent(
Transaction&, laddr_t, extent_len_t) = 0;
- virtual tm_future<NodeExtentRef> alloc_extent(Transaction&, extent_len_t) = 0;
- virtual tm_future<> retire_extent(Transaction&, NodeExtentRef) = 0;
- virtual tm_future<Super::URef> get_super(Transaction&, RootNodeTracker&) = 0;
+
+ using alloc_ertr = base_ertr;
+ virtual alloc_ertr::future<NodeExtentRef> alloc_extent(
+ Transaction&, extent_len_t) = 0;
+
+ using retire_ertr = base_ertr::extend<
+ crimson::ct_error::enoent>;
+ virtual retire_ertr::future<> retire_extent(
+ Transaction&, NodeExtentRef) = 0;
+
+ using getsuper_ertr = base_ertr;
+ virtual getsuper_ertr::future<Super::URef> get_super(
+ Transaction&, RootNodeTracker&) = 0;
+
virtual std::ostream& print(std::ostream& os) const = 0;
static NodeExtentManagerURef create_dummy(bool is_sync);
protected:
bool is_read_isolated() const override { return false; }
- tm_future<NodeExtentRef> read_extent(
+ read_ertr::future<NodeExtentRef> read_extent(
Transaction& t, laddr_t addr, extent_len_t len) override {
TRACET("reading {}B at {:#x} ...", t, len, addr);
if constexpr (SYNC) {
}
}
- tm_future<NodeExtentRef> alloc_extent(
+ alloc_ertr::future<NodeExtentRef> alloc_extent(
Transaction& t, extent_len_t len) override {
TRACET("allocating {}B ...", t, len);
if constexpr (SYNC) {
}
}
- tm_future<> retire_extent(
+ retire_ertr::future<> retire_extent(
Transaction& t, NodeExtentRef extent) override {
TRACET("retiring {}B at {:#x} ...",
t, extent->get_length(), extent->get_laddr());
}
}
- tm_future<Super::URef> get_super(
+ getsuper_ertr::future<Super::URef> get_super(
Transaction& t, RootNodeTracker& tracker) override {
TRACET("get root ...", t);
if constexpr (SYNC) {
}
private:
- tm_future<NodeExtentRef> read_extent_sync(
+ read_ertr::future<NodeExtentRef> read_extent_sync(
Transaction& t, laddr_t addr, extent_len_t len) {
auto iter = allocate_map.find(addr);
assert(iter != allocate_map.end());
TRACET("read {}B at {:#x}", t, extent->get_length(), extent->get_laddr());
assert(extent->get_laddr() == addr);
assert(extent->get_length() == len);
- return tm_ertr::make_ready_future<NodeExtentRef>(extent);
+ return read_ertr::make_ready_future<NodeExtentRef>(extent);
}
- tm_future<NodeExtentRef> alloc_extent_sync(
+ alloc_ertr::future<NodeExtentRef> alloc_extent_sync(
Transaction& t, extent_len_t len) {
assert(len % ALIGNMENT == 0);
auto r = ceph::buffer::create_aligned(len, ALIGNMENT);
allocate_map.insert({extent->get_laddr(), extent});
DEBUGT("allocated {}B at {:#x}", t, extent->get_length(), extent->get_laddr());
assert(extent->get_length() == len);
- return tm_ertr::make_ready_future<NodeExtentRef>(extent);
+ return alloc_ertr::make_ready_future<NodeExtentRef>(extent);
}
- tm_future<> retire_extent_sync(
+ retire_ertr::future<> retire_extent_sync(
Transaction& t, NodeExtentRef _extent) {
auto& extent = static_cast<DummyNodeExtent&>(*_extent.get());
auto addr = extent.get_laddr();
assert(iter != allocate_map.end());
allocate_map.erase(iter);
DEBUGT("retired {}B at {:#x}", t, len, addr);
- return tm_ertr::now();
+ return retire_ertr::now();
}
- tm_future<Super::URef> get_super_sync(
+ getsuper_ertr::future<Super::URef> get_super_sync(
Transaction& t, RootNodeTracker& tracker) {
TRACET("got root {:#x}", t, root_laddr);
- return tm_ertr::make_ready_future<Super::URef>(
+ return getsuper_ertr::make_ready_future<Super::URef>(
Super::URef(new DummySuper(t, tracker, &root_laddr)));
}
protected:
bool is_read_isolated() const override { return true; }
- tm_future<NodeExtentRef> read_extent(
+ read_ertr::future<NodeExtentRef> read_extent(
Transaction& t, laddr_t addr, extent_len_t len) override {
TRACET("reading {}B at {:#x} ...", t, len, addr);
return tm.read_extent<SeastoreNodeExtent>(t, addr, len
});
}
- tm_future<NodeExtentRef> alloc_extent(
+ alloc_ertr::future<NodeExtentRef> alloc_extent(
Transaction& t, extent_len_t len) override {
TRACET("allocating {}B ...", t, len);
return tm.alloc_extent<SeastoreNodeExtent>(t, addr_min, len
});
}
- tm_future<> retire_extent(
+ retire_ertr::future<> retire_extent(
Transaction& t, NodeExtentRef _extent) override {
LogicalCachedExtentRef extent = _extent;
auto addr = extent->get_laddr();
});
}
- tm_future<Super::URef> get_super(
+ getsuper_ertr::future<Super::URef> get_super(
Transaction& t, RootNodeTracker& tracker) override {
TRACET("get root ...", t);
return tm.read_onode_root(t).safe_then([this, &t, &tracker](auto root_addr) {