diff options
author | Daniel Zheng <zhengdaniel@google.com> | 2024-03-14 12:49:03 -0700 |
---|---|---|
committer | Daniel Zheng <zhengdaniel@google.com> | 2024-03-19 00:34:15 -0700 |
commit | 8e6ab87328e1a10c4c4ecb7036e2022968ca8326 (patch) | |
tree | 9e6b701cec45e5e506cb187b30cc6238dd98d7d2 /fs_mgr | |
parent | 0b671f4432303f6070ad5122110de31584181706 (diff) | |
download | core-8e6ab87328e1a10c4c4ecb7036e2022968ca8326.tar.gz |
libsnapshot: reserve 16x space for ops
We have updated logic for v3 cow we should allow non-data ops to be
cached at 16x the amount of data ops. Changing the reserve size to match
this.
Test: th
Change-Id: I825ffef4e1a2ce4eb5c105d266bf95cb3d776ed9
Diffstat (limited to 'fs_mgr')
-rw-r--r-- | fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp | 5 | ||||
-rw-r--r-- | fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.h | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp b/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp index de2e52833..ea1da4b53 100644 --- a/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp +++ b/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp @@ -173,7 +173,7 @@ bool CowWriterV3::ParseOptions() { batch_size_ = std::max<size_t>(options_.cluster_ops, 1); data_vec_.reserve(batch_size_); cached_data_.reserve(batch_size_); - cached_ops_.reserve(batch_size_); + cached_ops_.reserve(batch_size_ * kNonDataOpBufferSize); } if (batch_size_ > 1) { @@ -342,7 +342,8 @@ bool CowWriterV3::NeedsFlush() const { // Allow bigger batch sizes for ops without data. A single CowOperationV3 // struct uses 14 bytes of memory, even if we cache 200 * 16 ops in memory, // it's only ~44K. - return cached_data_.size() >= batch_size_ || cached_ops_.size() >= batch_size_ * 16; + return cached_data_.size() >= batch_size_ || + cached_ops_.size() >= batch_size_ * kNonDataOpBufferSize; } bool CowWriterV3::ConstructCowOpCompressedBuffers(uint64_t new_block_start, const void* data, diff --git a/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.h b/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.h index 48eb67bcc..e2dc69813 100644 --- a/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.h +++ b/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.h @@ -28,6 +28,9 @@ namespace android { namespace snapshot { using namespace android::storage_literals; +// This is a multiple on top of the number of data ops that can be stored in our cache at once. This +// is added so that we can cache more non-data ops as it takes up less space. +static constexpr uint32_t kNonDataOpBufferSize = 16; class CowWriterV3 : public CowWriterBase { public: |