Merge "libsnapshot: get options from protobuf fields" into main
This commit is contained in:
commit
6fe95136b5
5 changed files with 12 additions and 5 deletions
|
|
@ -114,6 +114,9 @@ message SnapshotStatus {
|
|||
|
||||
// Enable batching for COW writes
|
||||
bool batched_writes = 14;
|
||||
|
||||
// Size of v3 operation buffer. Needs to be determined during writer initialization
|
||||
uint64 estimated_ops_buffer_size = 15;
|
||||
}
|
||||
|
||||
// Next: 8
|
||||
|
|
@ -250,4 +253,7 @@ message SnapshotMergeReport {
|
|||
|
||||
// Whether this update attempt used io_uring.
|
||||
bool iouring_used = 13;
|
||||
|
||||
// Size of v3 operation buffer. Needs to be determined during writer initialization
|
||||
uint64 estimated_op_count_max = 14;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ struct CowOptions {
|
|||
bool batch_write = false;
|
||||
|
||||
// Size of the cow operation buffer; used in v3 only.
|
||||
uint32_t op_count_max = 0;
|
||||
uint64_t op_count_max = 0;
|
||||
};
|
||||
|
||||
// Interface for writing to a snapuserd COW. All operations are ordered; merges
|
||||
|
|
|
|||
|
|
@ -392,7 +392,6 @@ bool CowWriterV3::EmitLabel(uint64_t label) {
|
|||
}
|
||||
|
||||
bool CowWriterV3::EmitSequenceData(size_t num_ops, const uint32_t* data) {
|
||||
// TODO: size sequence buffer based on options
|
||||
if (header_.op_count > 0 || !cached_ops_.empty()) {
|
||||
LOG(ERROR) << "There's " << header_.op_count << " operations written to disk and "
|
||||
<< cached_ops_.size()
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ std::optional<PartitionCowCreator::Return> PartitionCowCreator::Run() {
|
|||
|
||||
if (update && update->has_estimate_cow_size()) {
|
||||
ret.snapshot_status.set_estimated_cow_size(update->estimate_cow_size());
|
||||
ret.snapshot_status.set_estimated_ops_buffer_size(update->estimate_op_count_max());
|
||||
}
|
||||
|
||||
if (ret.snapshot_status.snapshot_size() == 0) {
|
||||
|
|
|
|||
|
|
@ -3551,6 +3551,9 @@ Return SnapshotManager::InitializeUpdateSnapshots(
|
|||
options.scratch_space = false;
|
||||
}
|
||||
options.compression = it->second.compression_algorithm();
|
||||
if (cow_version >= 3) {
|
||||
options.op_count_max = it->second.estimated_ops_buffer_size();
|
||||
}
|
||||
|
||||
auto writer = CreateCowWriter(cow_version, options, std::move(fd));
|
||||
if (!writer->Finalize()) {
|
||||
|
|
@ -3662,9 +3665,7 @@ std::unique_ptr<ICowWriter> SnapshotManager::OpenCompressedSnapshotWriter(
|
|||
cow_options.max_blocks = {status.device_size() / cow_options.block_size};
|
||||
cow_options.batch_write = status.batched_writes();
|
||||
cow_options.num_compress_threads = status.enable_threading() ? 2 : 1;
|
||||
// TODO(b/313962438) Improve op_count estimate. For now, use number of
|
||||
// blocks as an upper bound.
|
||||
cow_options.op_count_max = status.device_size() / cow_options.block_size;
|
||||
cow_options.op_count_max = status.estimated_ops_buffer_size();
|
||||
// Disable scratch space for vts tests
|
||||
if (device()->IsTestDevice()) {
|
||||
cow_options.scratch_space = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue