}
};
+//#define CACHE_BLOB_BL // not sure if this is a win yet or not... :/
+
/// in-memory blob metadata and associated cached buffers (if any)
struct Blob {
MEMPOOL_CLASS_HELPERS();
private:
mutable bluestore_blob_t blob; ///< decoded blob metadata
- mutable bool dirty = true; ///< true if blob is newer than blob_bl
- mutable bufferlist blob_bl; ///< cached encoded blob
+#ifdef CACHE_BLOB_BL
+ mutable bufferlist blob_bl; ///< cached encoded blob, blob is dirty if empty
+#endif
/// refs from this shard. ephemeral if id<0, persisted if spanning.
bluestore_extent_ref_map_t ref_map;
void dup(Blob& o) {
o.shared_blob = shared_blob;
o.blob = blob;
- o.dirty = dirty;
+#ifdef CACHE_BLOB_BL
o.blob_bl = blob_bl;
+#endif
}
const bluestore_blob_t& get_blob() const {
return blob;
}
bluestore_blob_t& dirty_blob() {
- if (!dirty) {
- dirty = true;
- blob_bl.clear();
- }
+#ifdef CACHE_BLOB_BL
+ blob_bl.clear();
+#endif
return blob;
}
- bool is_dirty() const {
- return dirty;
- }
-
bool is_unreferenced(uint64_t offset, uint64_t length) const {
return !ref_map.intersects(offset, length);
}
delete this;
}
-//#define CACHE_BLOB_BL // not sure if this is a win yet or not... :/
#ifdef CACHE_BLOB_BL
void _encode() const {
- if (dirty) {
- blob_bl.clear();
+ if (blob_bl.length() == 0 ) {
::encode(blob, blob_bl);
- dirty = false;
} else {
assert(blob_bl.length());
}
const char *end = p.get_pos();
blob_bl.clear();
blob_bl.append(start, end - start);
- dirty = false;
if (include_ref_map) {
ref_map.decode(p);
}