aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot2017-11-01 23:50:39 -0500
committerandroid-build-team Robot2017-11-01 23:50:39 -0500
commit435a2031d62e868aae928ec3c4090ea3bbea3397 (patch)
tree1422024a19eae60caa2c60c5cf532ca27d203a30
parent43da85312213fdfd591ce66f6751a20dd01834fd (diff)
parentba30867b0174463bebefc92198ee24ec9e4bdfa3 (diff)
downloadplatform-bootable-recovery-d-oreo-mr1-release.tar.gz
platform-bootable-recovery-d-oreo-mr1-release.tar.xz
platform-bootable-recovery-d-oreo-mr1-release.zip
Merge cherrypicks of [3156476, 3155698, 3156194, 3156639, 3156018, 3156477, 3156098, 3156099, 3156100, 3156101, 3156102, 3158393, 3155699, 3155700, 3156195, 3156196, 3156019, 3156020, 3158394] into oc-mr1-releaseandroid-vts-8.1_r3android-cts-8.1_r3android-cts-8.1_r2android-cts-8.1_r1android-8.1.0_r6android-8.1.0_r5android-8.1.0_r4android-8.1.0_r3android-8.1.0_r16android-8.1.0_r15android-8.1.0_r12android-8.1.0_r11android-8.1.0_r10android-8.1.0_r1oreo-mr1-released-oreo-mr1-release
Change-Id: I2a293bf3975f633db807bb800e1707f73e8d74b9
-rw-r--r--update_verifier/update_verifier.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp
index faebbede..ba7b7aec 100644
--- a/update_verifier/update_verifier.cpp
+++ b/update_verifier/update_verifier.cpp
@@ -137,11 +137,12 @@ static bool read_blocks(const std::string& partition, const std::string& range_s
137 LOG(ERROR) << "Error in parsing range string."; 137 LOG(ERROR) << "Error in parsing range string.";
138 return false; 138 return false;
139 } 139 }
140 range_count /= 2;
140 141
141 std::vector<std::future<bool>> threads; 142 std::vector<std::future<bool>> threads;
142 size_t thread_num = std::thread::hardware_concurrency() ?: 4; 143 size_t thread_num = std::thread::hardware_concurrency() ?: 4;
143 thread_num = std::min(thread_num, range_count / 2); 144 thread_num = std::min(thread_num, range_count);
144 size_t group_range_count = range_count / thread_num; 145 size_t group_range_count = (range_count + thread_num - 1) / thread_num;
145 146
146 for (size_t t = 0; t < thread_num; t++) { 147 for (size_t t = 0; t < thread_num; t++) {
147 auto thread_func = [t, group_range_count, &dm_block_device, &ranges, &partition]() { 148 auto thread_func = [t, group_range_count, &dm_block_device, &ranges, &partition]() {
@@ -154,7 +155,8 @@ static bool read_blocks(const std::string& partition, const std::string& range_s
154 return false; 155 return false;
155 } 156 }
156 157
157 for (size_t i = 1 + group_range_count * t; i < group_range_count * (t + 1) + 1; i += 2) { 158 for (size_t i = group_range_count * 2 * t + 1;
159 i < std::min(group_range_count * 2 * (t + 1) + 1, ranges.size()); i += 2) {
158 unsigned int range_start, range_end; 160 unsigned int range_start, range_end;
159 bool parse_status = android::base::ParseUint(ranges[i], &range_start); 161 bool parse_status = android::base::ParseUint(ranges[i], &range_start);
160 parse_status = parse_status && android::base::ParseUint(ranges[i + 1], &range_end); 162 parse_status = parse_status && android::base::ParseUint(ranges[i + 1], &range_end);