o.push_back(new bluestore_cnode_t(123));
}
-// bluestore_extent_t
-
-string bluestore_extent_t::get_flags_string(unsigned flags)
-{
- string s;
- if (flags & FLAG_SHARED) {
- s = "shared";
- }
- return s;
-}
-
-void bluestore_extent_t::dump(Formatter *f) const
-{
- f->dump_unsigned("offset", offset);
- f->dump_unsigned("length", length);
- f->dump_unsigned("flags", flags);
-}
-
-void bluestore_extent_t::generate_test_instances(list<bluestore_extent_t*>& o)
-{
- o.push_back(new bluestore_extent_t());
- o.push_back(new bluestore_extent_t(123, 456));
- o.push_back(new bluestore_extent_t(789, 1024, 322));
-}
-
-ostream& operator<<(ostream& out, const bluestore_extent_t& e)
-{
- out << e.offset << "~" << e.length;
- if (e.flags)
- out << ":" << bluestore_extent_t::get_flags_string(e.flags);
- return out;
-}
-
// bluestore_extent_ref_map_t
void bluestore_extent_ref_map_t::_check() const
};
WRITE_CLASS_ENCODER(bluestore_cnode_t)
-/// extent: a byte extent back by the block device
-struct bluestore_extent_t {
- enum {
- FLAG_SHARED = 2, ///< extent is shared by another object, and refcounted
- };
- static string get_flags_string(unsigned flags);
-
- uint64_t offset;
- uint32_t length;
- uint32_t flags; /// or reserved
-
- bluestore_extent_t(uint64_t o=0, uint32_t l=0, uint32_t f=0)
- : offset(o), length(l), flags(f) {}
-
- uint64_t end() const {
- return offset + length;
- }
-
- bool has_flag(unsigned f) const {
- return flags & f;
- }
- void set_flag(unsigned f) {
- flags |= f;
- }
- void clear_flag(unsigned f) {
- flags &= ~f;
- }
-
- void encode(bufferlist& bl) const {
- ::encode(offset, bl);
- ::encode(length, bl);
- ::encode(flags, bl);
- }
- void decode(bufferlist::iterator& p) {
- ::decode(offset, p);
- ::decode(length, p);
- ::decode(flags, p);
- }
- void dump(Formatter *f) const;
- static void generate_test_instances(list<bluestore_extent_t*>& o);
-};
-WRITE_CLASS_ENCODER(bluestore_extent_t)
-
-ostream& operator<<(ostream& out, const bluestore_extent_t& bp);
-
-
/// pextent: physical extent
struct bluestore_pextent_t {
const static uint64_t INVALID_OFFSET = ~0ull;
#include "os/bluestore/bluestore_types.h"
TYPE(bluestore_cnode_t)
TYPE(bluestore_compression_header_t)
-TYPE(bluestore_extent_t)
TYPE(bluestore_extent_ref_map_t)
TYPE(bluestore_overlay_t)
TYPE(bluestore_pextent_t)