Loading fs_mgr/libsnapshot/android/snapshot/snapshot.proto +4 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ message SnapshotStatus { // The old partition size (if none existed, this will be zero). uint64 old_partition_size = 10; // Compression algorithm (none, gz, or brotli). // Compression algorithm (none, gz, lz4, zstd, or brotli). string compression_algorithm = 11; // Estimated COW size from OTA manifest. Loading @@ -117,6 +117,9 @@ message SnapshotStatus { // Size of v3 operation buffer. Needs to be determined during writer initialization uint64 estimated_ops_buffer_size = 15; // Max bytes to be compressed at once (4k, 8k, 16k, 32k, 64k, 128k) uint64 compression_factor = 16; } // Next: 8 Loading fs_mgr/libsnapshot/include/libsnapshot/cow_writer.h +3 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,9 @@ struct CowOptions { // Size of the cow operation buffer; used in v3 only. uint64_t op_count_max = 0; // Compression factor uint64_t compression_factor = 4096; }; // Interface for writing to a snapuserd COW. All operations are ordered; merges Loading fs_mgr/libsnapshot/partition_cow_creator.h +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ struct PartitionCowCreator { // True if snapuserd COWs are enabled. bool using_snapuserd = false; std::string compression_algorithm; uint64_t compression_factor; // True if multi-threaded compression should be enabled bool enable_threading; Loading fs_mgr/libsnapshot/snapshot.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -420,6 +420,7 @@ bool SnapshotManager::CreateSnapshot(LockedFile* lock, PartitionCowCreator* cow_ status->set_metadata_sectors(0); status->set_using_snapuserd(cow_creator->using_snapuserd); status->set_compression_algorithm(cow_creator->compression_algorithm); status->set_compression_factor(cow_creator->compression_factor); if (cow_creator->enable_threading) { status->set_enable_threading(cow_creator->enable_threading); } Loading Loading @@ -3233,8 +3234,10 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife } std::string compression_algorithm; uint64_t compression_factor{}; if (using_snapuserd) { compression_algorithm = dap_metadata.vabc_compression_param(); compression_factor = dap_metadata.compression_factor(); if (compression_algorithm.empty()) { // Older OTAs don't set an explicit compression type, so default to gz. compression_algorithm = "gz"; Loading @@ -3251,7 +3254,9 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife .extra_extents = {}, .using_snapuserd = using_snapuserd, .compression_algorithm = compression_algorithm, .compression_factor = compression_factor, }; if (dap_metadata.vabc_feature_set().has_threaded()) { cow_creator.enable_threading = dap_metadata.vabc_feature_set().threaded(); } Loading Loading @@ -3666,6 +3671,7 @@ std::unique_ptr<ICowWriter> SnapshotManager::OpenCompressedSnapshotWriter( cow_options.batch_write = status.batched_writes(); cow_options.num_compress_threads = status.enable_threading() ? 2 : 1; cow_options.op_count_max = status.estimated_ops_buffer_size(); cow_options.compression_factor = status.compression_factor(); // Disable scratch space for vts tests if (device()->IsTestDevice()) { cow_options.scratch_space = false; Loading Loading @@ -3793,6 +3799,7 @@ bool SnapshotManager::Dump(std::ostream& os) { ss << " allocated sectors: " << status.sectors_allocated() << std::endl; ss << " metadata sectors: " << status.metadata_sectors() << std::endl; ss << " compression: " << status.compression_algorithm() << std::endl; ss << " compression factor: " << status.compression_factor() << std::endl; ss << " merge phase: " << DecideMergePhase(status) << std::endl; } os << ss.rdbuf(); Loading Loading
fs_mgr/libsnapshot/android/snapshot/snapshot.proto +4 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ message SnapshotStatus { // The old partition size (if none existed, this will be zero). uint64 old_partition_size = 10; // Compression algorithm (none, gz, or brotli). // Compression algorithm (none, gz, lz4, zstd, or brotli). string compression_algorithm = 11; // Estimated COW size from OTA manifest. Loading @@ -117,6 +117,9 @@ message SnapshotStatus { // Size of v3 operation buffer. Needs to be determined during writer initialization uint64 estimated_ops_buffer_size = 15; // Max bytes to be compressed at once (4k, 8k, 16k, 32k, 64k, 128k) uint64 compression_factor = 16; } // Next: 8 Loading
fs_mgr/libsnapshot/include/libsnapshot/cow_writer.h +3 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,9 @@ struct CowOptions { // Size of the cow operation buffer; used in v3 only. uint64_t op_count_max = 0; // Compression factor uint64_t compression_factor = 4096; }; // Interface for writing to a snapuserd COW. All operations are ordered; merges Loading
fs_mgr/libsnapshot/partition_cow_creator.h +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ struct PartitionCowCreator { // True if snapuserd COWs are enabled. bool using_snapuserd = false; std::string compression_algorithm; uint64_t compression_factor; // True if multi-threaded compression should be enabled bool enable_threading; Loading
fs_mgr/libsnapshot/snapshot.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -420,6 +420,7 @@ bool SnapshotManager::CreateSnapshot(LockedFile* lock, PartitionCowCreator* cow_ status->set_metadata_sectors(0); status->set_using_snapuserd(cow_creator->using_snapuserd); status->set_compression_algorithm(cow_creator->compression_algorithm); status->set_compression_factor(cow_creator->compression_factor); if (cow_creator->enable_threading) { status->set_enable_threading(cow_creator->enable_threading); } Loading Loading @@ -3233,8 +3234,10 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife } std::string compression_algorithm; uint64_t compression_factor{}; if (using_snapuserd) { compression_algorithm = dap_metadata.vabc_compression_param(); compression_factor = dap_metadata.compression_factor(); if (compression_algorithm.empty()) { // Older OTAs don't set an explicit compression type, so default to gz. compression_algorithm = "gz"; Loading @@ -3251,7 +3254,9 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife .extra_extents = {}, .using_snapuserd = using_snapuserd, .compression_algorithm = compression_algorithm, .compression_factor = compression_factor, }; if (dap_metadata.vabc_feature_set().has_threaded()) { cow_creator.enable_threading = dap_metadata.vabc_feature_set().threaded(); } Loading Loading @@ -3666,6 +3671,7 @@ std::unique_ptr<ICowWriter> SnapshotManager::OpenCompressedSnapshotWriter( cow_options.batch_write = status.batched_writes(); cow_options.num_compress_threads = status.enable_threading() ? 2 : 1; cow_options.op_count_max = status.estimated_ops_buffer_size(); cow_options.compression_factor = status.compression_factor(); // Disable scratch space for vts tests if (device()->IsTestDevice()) { cow_options.scratch_space = false; Loading Loading @@ -3793,6 +3799,7 @@ bool SnapshotManager::Dump(std::ostream& os) { ss << " allocated sectors: " << status.sectors_allocated() << std::endl; ss << " metadata sectors: " << status.metadata_sectors() << std::endl; ss << " compression: " << status.compression_algorithm() << std::endl; ss << " compression factor: " << status.compression_factor() << std::endl; ss << " merge phase: " << DecideMergePhase(status) << std::endl; } os << ss.rdbuf(); Loading