From: Igor Fedotov Date: Mon, 19 Dec 2016 14:00:05 +0000 (+0000) Subject: os/bluestore: declare a member for Blob's cached bufferlist if explicitly enabled... X-Git-Tag: v11.1.1~19^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a6158d5cce7e6de39c98a17be5124d2a67c012c2;p=ceph.git os/bluestore: declare a member for Blob's cached bufferlist if explicitly enabled by CACHE_BLOG_BL macro only Signed-off-by: Igor Fedotov --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 2502e3be1bd9..56e8bc258fa6 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1331,7 +1331,6 @@ ostream& operator<<(ostream& out, const BlueStore::Blob& b) out << " spanning " << b.id; } out << " " << b.get_blob() << " " << b.get_ref_map() - << (b.is_dirty() ? " (dirty)" : " (clean)") << " " << *b.shared_blob << ")"; return out; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index f951546ca10b..d1673edfc5bd 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -409,6 +409,8 @@ public: } }; +//#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(); @@ -420,8 +422,9 @@ public: 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; @@ -451,24 +454,20 @@ public: 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); } @@ -495,14 +494,11 @@ public: 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()); } @@ -527,7 +523,6 @@ public: 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); }