}
}
+std::ostream &operator<<(std::ostream &out, const LBAPin &rhs)
+{
+ return out << "LBAPin(" << rhs.get_laddr() << "~" << rhs.get_length()
+ << "->" << rhs.get_paddr();
+}
+
+std::ostream &operator<<(std::ostream &out, const lba_pin_list_t &rhs)
+{
+ bool first = true;
+ out << '[';
+ for (auto &i: rhs) {
+ out << (first ? "" : ",") << *i;
+ first = false;
+ }
+ return out << ']';
+}
+
}
}
};
+class LBAPin;
+using LBAPinRef = std::unique_ptr<LBAPin>;
+class LBAPin {
+public:
+ virtual extent_len_t get_length() const = 0;
+ virtual paddr_t get_paddr() const = 0;
+ virtual laddr_t get_laddr() const = 0;
+ virtual LBAPinRef duplicate() const = 0;
+
+ virtual ~LBAPin() {}
+};
+std::ostream &operator<<(std::ostream &out, const LBAPin &rhs);
+
+using lba_pin_list_t = std::list<LBAPinRef>;
+
+std::ostream &operator<<(std::ostream &out, const lba_pin_list_t &rhs);
+
+
+/**
+ * LogicalCachedExtent
+ *
+ * CachedExtent with associated lba mapping.
+ *
+ * Users of TransactionManager should be using extents derived from
+ * LogicalCachedExtent.
+ */
+class LogicalCachedExtent : public CachedExtent {
+public:
+ template <typename... T>
+ LogicalCachedExtent(T&&... t) : CachedExtent(std::forward<T>(t)...) {}
+
+ void set_pin(LBAPinRef &&pin) { this->pin = std::move(pin); }
+
+ LBAPin &get_pin() {
+ assert(pin);
+ return *pin;
+ }
+
+ laddr_t get_laddr() const {
+ assert(pin);
+ return pin->get_laddr();
+ }
+
+ void apply_delta_and_adjust_crc(
+ paddr_t base, const ceph::bufferlist &bl) final {
+ apply_delta(bl);
+ set_last_committed_crc(get_crc32c());
+ }
+protected:
+ virtual void apply_delta(const ceph::bufferlist &bl) = 0;
+
+private:
+ LBAPinRef pin;
+};
+
+using LogicalCachedExtentRef = TCachedExtentRef<LogicalCachedExtent>;
+struct ref_laddr_cmp {
+ using is_transparent = laddr_t;
+ bool operator()(const LogicalCachedExtentRef &lhs,
+ const LogicalCachedExtentRef &rhs) const {
+ return lhs->get_laddr() < rhs->get_laddr();
+ }
+ bool operator()(const laddr_t &lhs,
+ const LogicalCachedExtentRef &rhs) const {
+ return lhs < rhs->get_laddr();
+ }
+ bool operator()(const LogicalCachedExtentRef &lhs,
+ const laddr_t &rhs) const {
+ return lhs->get_laddr() < rhs;
+ }
+};
+
+using lextent_set_t = addr_extent_set_base_t<
+ laddr_t,
+ LogicalCachedExtentRef,
+ ref_laddr_cmp
+ >;
+
+template <typename T>
+using lextent_list_t = addr_extent_list_base_t<
+ laddr_t, TCachedExtentRef<T>>;
}
}
}
-
-namespace crimson::os::seastore {
-
-std::ostream &operator<<(std::ostream &out, const LBAPin &rhs)
-{
- return out << "LBAPin(" << rhs.get_laddr() << "~" << rhs.get_length()
- << "->" << rhs.get_paddr();
-}
-
-std::ostream &operator<<(std::ostream &out, const lba_pin_list_t &rhs)
-{
- bool first = true;
- out << '[';
- for (auto &i: rhs) {
- out << (first ? "" : ",") << *i;
- first = false;
- }
- return out << ']';
-}
-
-};
namespace crimson::os::seastore {
-class LBAPin;
-using LBAPinRef = std::unique_ptr<LBAPin>;
-class LBAPin {
-public:
- virtual extent_len_t get_length() const = 0;
- virtual paddr_t get_paddr() const = 0;
- virtual laddr_t get_laddr() const = 0;
- virtual LBAPinRef duplicate() const = 0;
-
- virtual ~LBAPin() {}
-};
-std::ostream &operator<<(std::ostream &out, const LBAPin &rhs);
-
-using lba_pin_list_t = std::list<LBAPinRef>;
-
-std::ostream &operator<<(std::ostream &out, const lba_pin_list_t &rhs);
-
/**
* Abstract interface for managing the logical to physical mapping
*/
namespace crimson::os::seastore {
class Journal;
-/**
- * LogicalCachedExtent
- *
- * CachedExtent with associated lba mapping.
- *
- * Users of TransactionManager should be using extents derived from
- * LogicalCachedExtent.
- */
-class LogicalCachedExtent : public CachedExtent {
-public:
- template <typename... T>
- LogicalCachedExtent(T&&... t) : CachedExtent(std::forward<T>(t)...) {}
-
- void set_pin(LBAPinRef &&pin) { this->pin = std::move(pin); }
-
- LBAPin &get_pin() {
- assert(pin);
- return *pin;
- }
-
- laddr_t get_laddr() const {
- assert(pin);
- return pin->get_laddr();
- }
-
- void apply_delta_and_adjust_crc(
- paddr_t base, const ceph::bufferlist &bl) final {
- apply_delta(bl);
- set_last_committed_crc(get_crc32c());
- }
-protected:
- virtual void apply_delta(const ceph::bufferlist &bl) = 0;
-
-private:
- LBAPinRef pin;
-};
-
-using LogicalCachedExtentRef = TCachedExtentRef<LogicalCachedExtent>;
-struct ref_laddr_cmp {
- using is_transparent = laddr_t;
- bool operator()(const LogicalCachedExtentRef &lhs,
- const LogicalCachedExtentRef &rhs) const {
- return lhs->get_laddr() < rhs->get_laddr();
- }
- bool operator()(const laddr_t &lhs,
- const LogicalCachedExtentRef &rhs) const {
- return lhs < rhs->get_laddr();
- }
- bool operator()(const LogicalCachedExtentRef &lhs,
- const laddr_t &rhs) const {
- return lhs->get_laddr() < rhs;
- }
-};
-
-using lextent_set_t = addr_extent_set_base_t<
- laddr_t,
- LogicalCachedExtentRef,
- ref_laddr_cmp
- >;
-
-template <typename T>
-using lextent_list_t = addr_extent_list_base_t<
- laddr_t, TCachedExtentRef<T>>;
-
/**
* TransactionManager
*