Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Merge "Removing compression bit from v3 op" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zbw182 authored and Gerrit Code Review committed Oct 10, 2023
2 parents 3062a64 + ce57c58 commit f7f3b62
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 16 deletions.
4 changes: 0 additions & 4 deletions fs_mgr/libsnapshot/include/libsnapshot/cow_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,10 @@ static constexpr uint8_t kCowReadAheadInProgress = 1;
static constexpr uint8_t kCowReadAheadDone = 2;

static constexpr uint64_t kCowOpSourceInfoDataMask = (1ULL << 48) - 1;
static constexpr uint64_t kCowOpSourceInfoCompressBit = (1ULL << 63);

static inline uint64_t GetCowOpSourceInfoData(const CowOperation* op) {
return op->source_info & kCowOpSourceInfoDataMask;
}
static inline bool GetCowOpSourceInfoCompression(const CowOperation* op) {
return !!(op->source_info & kCowOpSourceInfoCompressBit);
}

struct CowFooter {
CowFooterOperation op;
Expand Down
5 changes: 0 additions & 5 deletions fs_mgr/libsnapshot/libsnapshot_cow/cow_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ std::ostream& operator<<(std::ostream& os, CowOperation const& op) {
os << "CowOperation(";
EmitCowTypeString(os, op.type);
if (op.type == kCowReplaceOp || op.type == kCowXorOp || op.type == kCowSequenceOp) {
if (op.source_info & kCowOpSourceInfoCompressBit) {
os << ", compressed";
} else {
os << ", uncompressed";
}
os << ", data_length:" << op.data_length;
}
if (op.type != kCowClusterOp && op.type != kCowSequenceOp && op.type != kCowLabelOp) {
Expand Down
1 change: 0 additions & 1 deletion fs_mgr/libsnapshot/libsnapshot_cow/cow_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ bool CowReader::Parse(android::base::borrowed_fd fd, std::optional<uint64_t> lab
<< v2_op.compression << ", op: " << v2_op;
return false;
}
source_info |= kCowOpSourceInfoCompressBit;
}
new_op.source_info = source_info;
}
Expand Down
6 changes: 0 additions & 6 deletions fs_mgr/libsnapshot/libsnapshot_cow/test_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ TEST_F(CowTest, ReadWrite) {
op = iter->Get();

ASSERT_EQ(op->type, kCowReplaceOp);
ASSERT_FALSE(GetCowOpSourceInfoCompression(op));
ASSERT_EQ(op->data_length, 4096);
ASSERT_EQ(op->new_block, 50);
ASSERT_TRUE(ReadData(reader, op, sink.data(), sink.size()));
Expand Down Expand Up @@ -219,7 +218,6 @@ TEST_F(CowTest, ReadWriteXor) {
op = iter->Get();

ASSERT_EQ(op->type, kCowXorOp);
ASSERT_FALSE(GetCowOpSourceInfoCompression(op));
ASSERT_EQ(op->data_length, 4096);
ASSERT_EQ(op->new_block, 50);
ASSERT_EQ(GetCowOpSourceInfoData(op), 98314); // 4096 * 24 + 10
Expand Down Expand Up @@ -276,7 +274,6 @@ TEST_F(CowTest, CompressGz) {
std::string sink(data.size(), '\0');

ASSERT_EQ(op->type, kCowReplaceOp);
ASSERT_TRUE(GetCowOpSourceInfoCompression(op));
ASSERT_EQ(op->data_length, 56); // compressed!
ASSERT_EQ(op->new_block, 50);
ASSERT_TRUE(ReadData(reader, op, sink.data(), sink.size()));
Expand Down Expand Up @@ -523,7 +520,6 @@ TEST_F(CowTest, ClusterCompressGz) {
std::string sink(data.size(), '\0');

ASSERT_EQ(op->type, kCowReplaceOp);
ASSERT_TRUE(GetCowOpSourceInfoCompression(op));
ASSERT_EQ(op->data_length, 56); // compressed!
ASSERT_EQ(op->new_block, 50);
ASSERT_TRUE(ReadData(reader, op, sink.data(), sink.size()));
Expand All @@ -541,7 +537,6 @@ TEST_F(CowTest, ClusterCompressGz) {

sink = {};
sink.resize(data2.size(), '\0');
ASSERT_TRUE(GetCowOpSourceInfoCompression(op));
ASSERT_EQ(op->data_length, 41); // compressed!
ASSERT_EQ(op->new_block, 51);
ASSERT_TRUE(ReadData(reader, op, sink.data(), sink.size()));
Expand Down Expand Up @@ -586,7 +581,6 @@ TEST_F(CowTest, CompressTwoBlocks) {

auto op = iter->Get();
ASSERT_EQ(op->type, kCowReplaceOp);
ASSERT_TRUE(GetCowOpSourceInfoCompression(op));
ASSERT_EQ(op->new_block, 51);
ASSERT_TRUE(ReadData(reader, op, sink.data(), sink.size()));
}
Expand Down

0 comments on commit f7f3b62

Please sign in to comment.