s += '+';
s += "has_unused";
}
+ if (flags & FLAG_HAS_REFMAP) {
+ if (s.length())
+ s += '+';
+ s += "has_refmap";
+ }
return s;
}
small_encode_varint(csum_chunk_order, bl);
small_encode_buf_lowz(csum_data, bl);
}
- ::encode(ref_map, bl);
+ if (has_refmap()) {
+ ::encode(ref_map, bl);
+ }
if (has_unused()) {
::encode( unused_uint_t(unused.to_ullong()), bl);
}
csum_type = CSUM_NONE;
csum_chunk_order = 0;
}
- ::decode(ref_map, p);
+ if (has_refmap()) {
+ ::decode(ref_map, p);
+ }
if (has_unused()) {
unused_uint_t val;
::decode(val, p);
return out;
}
+void bluestore_blob_t::get_ref(
+ uint64_t offset,
+ uint64_t length)
+{
+ assert(has_refmap());
+ ref_map.get(offset, length);
+}
+
void bluestore_blob_t::put_ref(
uint64_t offset,
uint64_t length,
uint64_t min_release_size,
vector<bluestore_pextent_t> *r)
{
+ assert(has_refmap());
vector<bluestore_pextent_t> logical;
ref_map.put(offset, length, &logical);
FLAG_COMPRESSED = 2, ///< blob is compressed
FLAG_CSUM = 4, ///< blob has checksums
FLAG_HAS_UNUSED = 8, ///< blob has unused map
+ FLAG_HAS_REFMAP = 16, ///< blob has non-empty reference map
};
static string get_flags_string(unsigned flags);
typedef std::bitset<sizeof(unused_uint_t) * 8> unused_t;
unused_t unused; ///< portion that has never been written to
- bluestore_blob_t(uint32_t f = 0) : flags(f) {}
+ bluestore_blob_t(uint32_t f = 0) : flags(f) {
+ set_flag(FLAG_HAS_REFMAP);
+ }
void encode(bufferlist& bl) const;
void decode(bufferlist::iterator& p);
bool has_unused() const {
return has_flag(FLAG_HAS_UNUSED);
}
+ bool has_refmap() const {
+ return has_flag(FLAG_HAS_REFMAP);
+ }
/// return chunk (i.e. min readable block) size for the blob
uint64_t get_chunk_size(uint64_t dev_block_size) {
}
}
+ /// get logical references
+ void get_ref(uint64_t offset, uint64_t length);
/// put logical references, and get back any released extents
- void put_ref(uint64_t offset, uint64_t length, uint64_t min_alloc_size,
+ void put_ref(uint64_t offset, uint64_t length, uint64_t min_alloc_size,
vector<bluestore_pextent_t> *r);
void map(uint64_t x_off, uint64_t x_len,