diff --git a/fs_mgr/libsnapshot/snapuserd/user-space-merge/merge_worker.cpp b/fs_mgr/libsnapshot/snapuserd/user-space-merge/merge_worker.cpp index bd7eaca74..0f4674ced 100644 --- a/fs_mgr/libsnapshot/snapuserd/user-space-merge/merge_worker.cpp +++ b/fs_mgr/libsnapshot/snapuserd/user-space-merge/merge_worker.cpp @@ -577,8 +577,10 @@ bool MergeWorker::Run() { SNAP_LOG(ERROR) << "Merge terminated early..."; return true; } + auto merge_thread_priority = android::base::GetUintProperty( + "ro.virtual_ab.merge_thread_priority", ANDROID_PRIORITY_BACKGROUND); - if (!SetThreadPriority(ANDROID_PRIORITY_BACKGROUND)) { + if (!SetThreadPriority(merge_thread_priority)) { SNAP_PLOG(ERROR) << "Failed to set thread priority"; } diff --git a/fs_mgr/libsnapshot/snapuserd/user-space-merge/read_worker.cpp b/fs_mgr/libsnapshot/snapuserd/user-space-merge/read_worker.cpp index d40b6d11d..35a162199 100644 --- a/fs_mgr/libsnapshot/snapuserd/user-space-merge/read_worker.cpp +++ b/fs_mgr/libsnapshot/snapuserd/user-space-merge/read_worker.cpp @@ -17,8 +17,10 @@ #include #include +#include "android-base/properties.h" #include "read_worker.h" #include "snapuserd_core.h" +#include "user-space-merge/worker.h" #include "utility.h" namespace android { @@ -259,8 +261,10 @@ bool ReadWorker::Run() { SNAP_LOG(INFO) << "Processing snapshot I/O requests...."; pthread_setname_np(pthread_self(), "ReadWorker"); + auto worker_thread_priority = android::base::GetUintProperty( + "ro.virtual_ab.worker_thread_priority", ANDROID_PRIORITY_NORMAL); - if (!SetThreadPriority(ANDROID_PRIORITY_NORMAL)) { + if (!SetThreadPriority(worker_thread_priority)) { SNAP_PLOG(ERROR) << "Failed to set thread priority"; } diff --git a/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_verify.cpp b/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_verify.cpp index 681734080..957c6a8a7 100644 --- a/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_verify.cpp +++ b/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_verify.cpp @@ -20,6 +20,7 @@ #include #include +#include "android-base/properties.h" #include "snapuserd_core.h" namespace android { @@ -104,7 +105,9 @@ bool UpdateVerify::VerifyBlocks(const std::string& partition_name, } loff_t file_offset = offset; - const uint64_t read_sz = kBlockSizeVerify; + auto verify_block_size = android::base::GetUintProperty("ro.virtual_ab.verify_block_size", + kBlockSizeVerify); + const uint64_t read_sz = verify_block_size; void* addr; ssize_t page_size = getpagesize(); @@ -130,7 +133,7 @@ bool UpdateVerify::VerifyBlocks(const std::string& partition_name, } bytes_read += to_read; - file_offset += (skip_blocks * kBlockSizeVerify); + file_offset += (skip_blocks * verify_block_size); if (file_offset >= dev_sz) { break; } @@ -184,7 +187,9 @@ bool UpdateVerify::VerifyPartition(const std::string& partition_name, * latency. */ int num_threads = kMinThreadsToVerify; - if (dev_sz > kThresholdSize) { + auto verify_threshold_size = android::base::GetUintProperty( + "ro.virtual_ab.verify_threshold_size", kThresholdSize); + if (dev_sz > verify_threshold_size) { num_threads = kMaxThreadsToVerify; } @@ -192,11 +197,13 @@ bool UpdateVerify::VerifyPartition(const std::string& partition_name, off_t start_offset = 0; const int skip_blocks = num_threads; + auto verify_block_size = + android::base::GetUintProperty("ro.virtual_ab.verify_block_size", kBlockSizeVerify); while (num_threads) { threads.emplace_back(std::async(std::launch::async, &UpdateVerify::VerifyBlocks, this, partition_name, dm_block_device, start_offset, skip_blocks, dev_sz)); - start_offset += kBlockSizeVerify; + start_offset += verify_block_size; num_threads -= 1; if (start_offset >= dev_sz) { break;