This is a "magic" offset that we can use to indicate an invalid extent
(vs, say, an extent at offset 0 that might clobber real data if it were
used).
Signed-off-by: Sage Weil <sage@redhat.com>
}
ostream& operator<<(ostream& out, const bluestore_pextent_t& o) {
- return out << "0x" << std::hex << o.offset << "~0x" << o.length << std::dec;
+ if (o.is_valid())
+ return out << "0x" << std::hex << o.offset << "~0x" << o.length << std::dec;
+ else
+ return out << "!~0x" << std::hex << o.length << std::dec;
}
void bluestore_pextent_t::generate_test_instances(list<bluestore_pextent_t*>& ls)
/// pextent: physical extent
struct bluestore_pextent_t {
+ const static uint64_t INVALID_OFFSET = ~0ull;
+
uint64_t offset, length; ///< location on device
bluestore_pextent_t() : offset(0), length(0) {}
return offset + length;
}
+ bool is_valid() const {
+ return offset != INVALID_OFFSET;
+ }
+
void encode(bufferlist& bl) const {
::encode(offset, bl);
::encode(length, bl);