Skip to content

Commit

Permalink
Merge cherrypicks of [3156476, 3155698, 3156194, 3156639, 3156018, 31…
Browse files Browse the repository at this point in the history
…56477, 3156098, 3156099, 3156100, 3156101, 3156102, 3158393, 3155699, 3155700, 3156195, 3156196, 3156019, 3156020, 3158394] into oc-mr1-release

Change-Id: I2a293bf3975f633db807bb800e1707f73e8d74b9
  • Loading branch information
android-build-team Robot committed Nov 2, 2017
2 parents 43da853 + ba30867 commit 435a203
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions update_verifier/update_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ static bool read_blocks(const std::string& partition, const std::string& range_s
LOG(ERROR) << "Error in parsing range string.";
return false;
}
range_count /= 2;

std::vector<std::future<bool>> threads;
size_t thread_num = std::thread::hardware_concurrency() ?: 4;
thread_num = std::min(thread_num, range_count / 2);
size_t group_range_count = range_count / thread_num;
thread_num = std::min(thread_num, range_count);
size_t group_range_count = (range_count + thread_num - 1) / thread_num;

for (size_t t = 0; t < thread_num; t++) {
auto thread_func = [t, group_range_count, &dm_block_device, &ranges, &partition]() {
Expand All @@ -154,7 +155,8 @@ static bool read_blocks(const std::string& partition, const std::string& range_s
return false;
}

for (size_t i = 1 + group_range_count * t; i < group_range_count * (t + 1) + 1; i += 2) {
for (size_t i = group_range_count * 2 * t + 1;
i < std::min(group_range_count * 2 * (t + 1) + 1, ranges.size()); i += 2) {
unsigned int range_start, range_end;
bool parse_status = android::base::ParseUint(ranges[i], &range_start);
parse_status = parse_status && android::base::ParseUint(ranges[i + 1], &range_end);
Expand Down

0 comments on commit 435a203

Please sign in to comment.