From 628f4edec005d02dbf760a4b9e3b7127a33fa09f Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Thu, 9 Apr 2015 23:29:29 +0200 Subject: [PATCH] Don't flush if not necessary --- implementations/onblocks/datatreestore/DataTree.cpp | 2 -- implementations/onblocks/datatreestore/DataTree.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/implementations/onblocks/datatreestore/DataTree.cpp b/implementations/onblocks/datatreestore/DataTree.cpp index f1734e8a..caa53131 100644 --- a/implementations/onblocks/datatreestore/DataTree.cpp +++ b/implementations/onblocks/datatreestore/DataTree.cpp @@ -115,7 +115,6 @@ void DataTree::traverseLeaves(uint32_t beginIndex, uint32_t endIndex, function(this)->traverseLeaves(beginIndex, endIndex, [func](const DataLeafNode* leaf, uint32_t leafIndex) { func(const_cast(leaf), leafIndex); }); - flush(); } void DataTree::traverseLeaves(uint32_t beginIndex, uint32_t endIndex, function func) const { @@ -196,7 +195,6 @@ void DataTree::resizeNumBytes(uint64_t newNumBytes) { } uint32_t newLastLeafSize = newNumBytes - (newNumLeaves-1)*_nodeStore->layout().maxBytesPerLeaf(); LastLeaf(_rootNode.get())->resize(newLastLeafSize); - flush(); } assert(newNumBytes == numStoredBytes()); } diff --git a/implementations/onblocks/datatreestore/DataTree.h b/implementations/onblocks/datatreestore/DataTree.h index af047e41..0d726e13 100644 --- a/implementations/onblocks/datatreestore/DataTree.h +++ b/implementations/onblocks/datatreestore/DataTree.h @@ -35,6 +35,8 @@ public: uint64_t numStoredBytes() const; + void flush() const; + private: mutable boost::shared_mutex _mutex; datanodestore::DataNodeStore *_nodeStore; @@ -61,8 +63,6 @@ private: cpputils::optional_ownership_ptr LastLeaf(datanodestore::DataNode *root); std::unique_ptr LastLeaf(std::unique_ptr root); - void flush() const; - DISALLOW_COPY_AND_ASSIGN(DataTree); };