Merge "Update API usage for source" into main am: a065e8739e
am: 79693491d1
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2779370 Change-Id: I22afbb4ab68a8a5026108464ad2f4631c42d8e42 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
dcdab5ec9b
5 changed files with 28 additions and 28 deletions
|
@ -202,8 +202,8 @@ static constexpr uint8_t kCowReadAheadDone = 2;
|
|||
|
||||
static constexpr uint64_t kCowOpSourceInfoDataMask = (1ULL << 48) - 1;
|
||||
|
||||
static inline uint64_t GetCowOpSourceInfoData(const CowOperation* op) {
|
||||
return op->source_info & kCowOpSourceInfoDataMask;
|
||||
static inline uint64_t GetCowOpSourceInfoData(const CowOperation& op) {
|
||||
return op.source_info & kCowOpSourceInfoDataMask;
|
||||
}
|
||||
|
||||
struct CowFooter {
|
||||
|
|
|
@ -576,7 +576,7 @@ bool CowReader::GetRawBytes(const CowOperation* op, void* buffer, size_t len, si
|
|||
case kCowSequenceOp:
|
||||
case kCowReplaceOp:
|
||||
case kCowXorOp:
|
||||
return GetRawBytes(GetCowOpSourceInfoData(op), buffer, len, read);
|
||||
return GetRawBytes(GetCowOpSourceInfoData(*op), buffer, len, read);
|
||||
default:
|
||||
LOG(ERROR) << "Cannot get raw bytes of non-data op: " << *op;
|
||||
return false;
|
||||
|
@ -668,7 +668,7 @@ ssize_t CowReader::ReadData(const CowOperation* op, void* buffer, size_t buffer_
|
|||
if (op->type == kCowXorOp) {
|
||||
offset = data_loc_->at(op->new_block);
|
||||
} else {
|
||||
offset = GetCowOpSourceInfoData(op);
|
||||
offset = GetCowOpSourceInfoData(*op);
|
||||
}
|
||||
|
||||
if (!decompressor) {
|
||||
|
@ -684,10 +684,10 @@ ssize_t CowReader::ReadData(const CowOperation* op, void* buffer, size_t buffer_
|
|||
bool CowReader::GetSourceOffset(const CowOperation* op, uint64_t* source_offset) {
|
||||
switch (op->type) {
|
||||
case kCowCopyOp:
|
||||
*source_offset = GetCowOpSourceInfoData(op) * header_.block_size;
|
||||
*source_offset = GetCowOpSourceInfoData(*op) * header_.block_size;
|
||||
return true;
|
||||
case kCowXorOp:
|
||||
*source_offset = GetCowOpSourceInfoData(op);
|
||||
*source_offset = GetCowOpSourceInfoData(*op);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -88,7 +88,7 @@ TEST_F(CowTest, CopyContiguous) {
|
|||
ASSERT_EQ(op->type, kCowCopyOp);
|
||||
ASSERT_EQ(op->data_length, 0);
|
||||
ASSERT_EQ(op->new_block, 10 + i);
|
||||
ASSERT_EQ(op->source_info, 1000 + i);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 1000 + i);
|
||||
iter->Next();
|
||||
i += 1;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ TEST_F(CowTest, ReadWrite) {
|
|||
ASSERT_EQ(op->type, kCowCopyOp);
|
||||
ASSERT_EQ(op->data_length, 0);
|
||||
ASSERT_EQ(op->new_block, 10);
|
||||
ASSERT_EQ(op->source_info, 20);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 20);
|
||||
|
||||
std::string sink(data.size(), '\0');
|
||||
|
||||
|
@ -156,7 +156,7 @@ TEST_F(CowTest, ReadWrite) {
|
|||
ASSERT_EQ(op->type, kCowZeroOp);
|
||||
ASSERT_EQ(op->data_length, 0);
|
||||
ASSERT_EQ(op->new_block, 51);
|
||||
ASSERT_EQ(op->source_info, 0);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 0);
|
||||
|
||||
iter->Next();
|
||||
ASSERT_FALSE(iter->AtEnd());
|
||||
|
@ -165,7 +165,7 @@ TEST_F(CowTest, ReadWrite) {
|
|||
ASSERT_EQ(op->type, kCowZeroOp);
|
||||
ASSERT_EQ(op->data_length, 0);
|
||||
ASSERT_EQ(op->new_block, 52);
|
||||
ASSERT_EQ(op->source_info, 0);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 0);
|
||||
|
||||
iter->Next();
|
||||
ASSERT_TRUE(iter->AtEnd());
|
||||
|
@ -209,7 +209,7 @@ TEST_F(CowTest, ReadWriteXor) {
|
|||
ASSERT_EQ(op->type, kCowCopyOp);
|
||||
ASSERT_EQ(op->data_length, 0);
|
||||
ASSERT_EQ(op->new_block, 10);
|
||||
ASSERT_EQ(op->source_info, 20);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 20);
|
||||
|
||||
std::string sink(data.size(), '\0');
|
||||
|
||||
|
@ -220,7 +220,7 @@ TEST_F(CowTest, ReadWriteXor) {
|
|||
ASSERT_EQ(op->type, kCowXorOp);
|
||||
ASSERT_EQ(op->data_length, 4096);
|
||||
ASSERT_EQ(op->new_block, 50);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(op), 98314); // 4096 * 24 + 10
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 98314); // 4096 * 24 + 10
|
||||
ASSERT_TRUE(ReadData(reader, op, sink.data(), sink.size()));
|
||||
ASSERT_EQ(sink, data);
|
||||
|
||||
|
@ -232,7 +232,7 @@ TEST_F(CowTest, ReadWriteXor) {
|
|||
ASSERT_EQ(op->type, kCowZeroOp);
|
||||
ASSERT_EQ(op->data_length, 0);
|
||||
ASSERT_EQ(op->new_block, 51);
|
||||
ASSERT_EQ(op->source_info, 0);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 0);
|
||||
|
||||
iter->Next();
|
||||
ASSERT_FALSE(iter->AtEnd());
|
||||
|
@ -241,7 +241,7 @@ TEST_F(CowTest, ReadWriteXor) {
|
|||
ASSERT_EQ(op->type, kCowZeroOp);
|
||||
ASSERT_EQ(op->data_length, 0);
|
||||
ASSERT_EQ(op->new_block, 52);
|
||||
ASSERT_EQ(op->source_info, 0);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 0);
|
||||
|
||||
iter->Next();
|
||||
ASSERT_TRUE(iter->AtEnd());
|
||||
|
@ -329,7 +329,7 @@ TEST_P(CompressionTest, ThreadedBatchWrites) {
|
|||
total_blocks += 1;
|
||||
std::string sink(xor_data.size(), '\0');
|
||||
ASSERT_EQ(op->new_block, 50);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(op), 98314); // 4096 * 24 + 10
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 98314); // 4096 * 24 + 10
|
||||
ASSERT_TRUE(ReadData(reader, op, sink.data(), sink.size()));
|
||||
ASSERT_EQ(sink, xor_data);
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ TEST_F(CowTest, AppendLabelSmall) {
|
|||
ASSERT_FALSE(iter->AtEnd());
|
||||
op = iter->Get();
|
||||
ASSERT_EQ(op->type, kCowLabelOp);
|
||||
ASSERT_EQ(op->source_info, 3);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 3);
|
||||
|
||||
iter->Next();
|
||||
|
||||
|
@ -717,7 +717,7 @@ TEST_F(CowTest, AppendLabelMissing) {
|
|||
ASSERT_FALSE(iter->AtEnd());
|
||||
auto op = iter->Get();
|
||||
ASSERT_EQ(op->type, kCowLabelOp);
|
||||
ASSERT_EQ(op->source_info, 0);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 0);
|
||||
|
||||
iter->Next();
|
||||
|
||||
|
@ -775,7 +775,7 @@ TEST_F(CowTest, AppendExtendedCorrupted) {
|
|||
ASSERT_FALSE(iter->AtEnd());
|
||||
auto op = iter->Get();
|
||||
ASSERT_EQ(op->type, kCowLabelOp);
|
||||
ASSERT_EQ(op->source_info, 5);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 5);
|
||||
|
||||
iter->Next();
|
||||
ASSERT_TRUE(iter->AtEnd());
|
||||
|
@ -844,7 +844,7 @@ TEST_F(CowTest, AppendbyLabel) {
|
|||
ASSERT_FALSE(iter->AtEnd());
|
||||
op = iter->Get();
|
||||
ASSERT_EQ(op->type, kCowLabelOp);
|
||||
ASSERT_EQ(op->source_info, 4);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 4);
|
||||
|
||||
iter->Next();
|
||||
|
||||
|
@ -862,7 +862,7 @@ TEST_F(CowTest, AppendbyLabel) {
|
|||
ASSERT_FALSE(iter->AtEnd());
|
||||
op = iter->Get();
|
||||
ASSERT_EQ(op->type, kCowLabelOp);
|
||||
ASSERT_EQ(op->source_info, 5);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 5);
|
||||
|
||||
iter->Next();
|
||||
|
||||
|
@ -915,7 +915,7 @@ TEST_F(CowTest, ClusterTest) {
|
|||
ASSERT_FALSE(iter->AtEnd());
|
||||
op = iter->Get();
|
||||
ASSERT_EQ(op->type, kCowLabelOp);
|
||||
ASSERT_EQ(op->source_info, 4);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 4);
|
||||
|
||||
iter->Next();
|
||||
|
||||
|
@ -940,7 +940,7 @@ TEST_F(CowTest, ClusterTest) {
|
|||
ASSERT_FALSE(iter->AtEnd());
|
||||
op = iter->Get();
|
||||
ASSERT_EQ(op->type, kCowLabelOp);
|
||||
ASSERT_EQ(op->source_info, 5);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 5);
|
||||
|
||||
iter->Next();
|
||||
|
||||
|
@ -959,7 +959,7 @@ TEST_F(CowTest, ClusterTest) {
|
|||
ASSERT_FALSE(iter->AtEnd());
|
||||
op = iter->Get();
|
||||
ASSERT_EQ(op->type, kCowLabelOp);
|
||||
ASSERT_EQ(op->source_info, 6);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 6);
|
||||
|
||||
iter->Next();
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ TEST_F(CowTest, ClusterAppendTest) {
|
|||
ASSERT_FALSE(iter->AtEnd());
|
||||
auto op = iter->Get();
|
||||
ASSERT_EQ(op->type, kCowLabelOp);
|
||||
ASSERT_EQ(op->source_info, 50);
|
||||
ASSERT_EQ(GetCowOpSourceInfoData(*op), 50);
|
||||
|
||||
iter->Next();
|
||||
|
||||
|
|
|
@ -508,7 +508,7 @@ bool Snapuserd::ReadMetadata() {
|
|||
// the merge of operations are done based on the ops present
|
||||
// in the file.
|
||||
//===========================================================
|
||||
uint64_t block_source = GetCowOpSourceInfoData(cow_op);
|
||||
uint64_t block_source = GetCowOpSourceInfoData(*cow_op);
|
||||
if (prev_id.has_value()) {
|
||||
if (dest_blocks.count(cow_op->new_block) || source_blocks.count(block_source)) {
|
||||
break;
|
||||
|
|
|
@ -172,7 +172,7 @@ ReadAheadThread::ReadAheadThread(const std::string& cow_device, const std::strin
|
|||
}
|
||||
|
||||
void ReadAheadThread::CheckOverlap(const CowOperation* cow_op) {
|
||||
uint64_t source_block = GetCowOpSourceInfoData(cow_op);
|
||||
uint64_t source_block = GetCowOpSourceInfoData(*cow_op);
|
||||
if (dest_blocks_.count(cow_op->new_block) || source_blocks_.count(source_block)) {
|
||||
overlap_ = true;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ void ReadAheadThread::PrepareReadAhead(uint64_t* source_offset, int* pending_ops
|
|||
// Get the first block with offset
|
||||
const CowOperation* cow_op = GetRAOpIter();
|
||||
CHECK_NE(cow_op, nullptr);
|
||||
*source_offset = GetCowOpSourceInfoData(cow_op);
|
||||
*source_offset = GetCowOpSourceInfoData(*cow_op);
|
||||
if (cow_op->type == kCowCopyOp) {
|
||||
*source_offset *= BLOCK_SZ;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ void ReadAheadThread::PrepareReadAhead(uint64_t* source_offset, int* pending_ops
|
|||
while (!RAIterDone() && num_ops) {
|
||||
const CowOperation* op = GetRAOpIter();
|
||||
CHECK_NE(op, nullptr);
|
||||
uint64_t next_offset = GetCowOpSourceInfoData(op);
|
||||
uint64_t next_offset = GetCowOpSourceInfoData(*op);
|
||||
if (op->type == kCowCopyOp) {
|
||||
next_offset *= BLOCK_SZ;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue