]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: declare a member for Blob's cached bufferlist if explicitly enabled...
authorIgor Fedotov <ifedotov@mirantis.com>
Mon, 19 Dec 2016 14:00:05 +0000 (14:00 +0000)
committerIgor Fedotov <ifedotov@mirantis.com>
Mon, 19 Dec 2016 15:06:39 +0000 (15:06 +0000)
Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 2502e3be1bd9a935616ffd351a608fa9563a2fcc..56e8bc258fa6b352568d1f14a2ec2cec6ff785ab 100644 (file)
@@ -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;
index f951546ca10be9351bdf97e8a92a662bcf632760..d1673edfc5bd881946248567539212b4e25e2040 100644 (file)
@@ -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);
       }