Merge "Create_cow: Hash of target blocks should not be stored." into main
This commit is contained in:
commit
a2cd2202f0
1 changed files with 6 additions and 4 deletions
|
|
@ -240,9 +240,11 @@ bool CreateSnapshot::ReadBlocks(off_t offset, const int skip_blocks, const uint6
|
||||||
SHA256(bufptr, BLOCK_SZ, checksum);
|
SHA256(bufptr, BLOCK_SZ, checksum);
|
||||||
std::string hash = ToHexString(checksum, sizeof(checksum));
|
std::string hash = ToHexString(checksum, sizeof(checksum));
|
||||||
|
|
||||||
if (create_snapshot_patch_ && !WriteSnapshot(bufptr, blkindex, hash)) {
|
if (create_snapshot_patch_) {
|
||||||
LOG(ERROR) << "WriteSnapshot failed for block: " << blkindex;
|
if (!WriteSnapshot(bufptr, blkindex, hash)) {
|
||||||
return false;
|
LOG(ERROR) << "WriteSnapshot failed for block: " << blkindex;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
std::lock_guard<std::mutex> lock(source_block_hash_lock_);
|
std::lock_guard<std::mutex> lock(source_block_hash_lock_);
|
||||||
{
|
{
|
||||||
|
|
@ -256,7 +258,7 @@ bool CreateSnapshot::ReadBlocks(off_t offset, const int skip_blocks, const uint6
|
||||||
num_blocks -= 1;
|
num_blocks -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
file_offset += (skip_blocks * kBlockSizeToRead);
|
file_offset += (skip_blocks * to_read);
|
||||||
if (file_offset >= dev_sz) {
|
if (file_offset >= dev_sz) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue