From c1a18756dc2f0a28f32b076e3f9f46b09aac0825 Mon Sep 17 00:00:00 2001 From: Daniel Zheng Date: Thu, 9 Nov 2023 14:00:48 -0800 Subject: [PATCH 1/2] libsnapshot: v3 writer GetCowSize Cow size should just be wherever the last data position is written. In v3 we no longer have a footer, so this calculation is simple. This function is used by cow estimator Test: cow_api_test Change-Id: I08204e2d560b120450019a529baa41de9b8e66d5 --- fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp b/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp index 89fd903db..7fe7b4157 100644 --- a/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp +++ b/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp @@ -360,9 +360,7 @@ bool CowWriterV3::Finalize() { } uint64_t CowWriterV3::GetCowSize() { - LOG(ERROR) << __LINE__ << " " << __FILE__ - << " <- Get Cow Size function here should never be called"; - return 0; + return next_data_pos_; } } // namespace snapshot From a50345376730f98252cf771b20d8c7e7e7682074 Mon Sep 17 00:00:00 2001 From: Daniel Zheng Date: Mon, 13 Nov 2023 14:53:28 -0800 Subject: [PATCH 2/2] libsnapshot: update FindResumeOp type Update FindResumeOp to take in a uint64_t to match the value of the caller function Test: ota with following CL Change-Id: I19568d119b7ebd75ea9e98970b311ae7da92ff0e --- fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.cpp | 2 +- fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.cpp b/fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.cpp index d411ab945..695913a32 100644 --- a/fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.cpp +++ b/fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.cpp @@ -82,7 +82,7 @@ bool CowParserV3::ReadResumeBuffer(borrowed_fd fd) { header_.prefix.header_size + header_.buffer_size); } -std::optional CowParserV3::FindResumeOp(const uint32_t label) { +std::optional CowParserV3::FindResumeOp(const uint64_t label) { for (auto& resume_point : *resume_points_) { if (resume_point.label == label) { return resume_point.op_index; diff --git a/fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.h b/fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.h index dceb815fe..fe3a2fb18 100644 --- a/fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.h +++ b/fs_mgr/libsnapshot/libsnapshot_cow/parser_v3.h @@ -49,7 +49,7 @@ class CowParserV3 final : public CowParserBase { private: bool ParseOps(android::base::borrowed_fd fd, const uint32_t op_index); - std::optional FindResumeOp(const uint32_t label); + std::optional FindResumeOp(const uint64_t label); off_t GetDataOffset() const; CowHeaderV3 header_ = {}; std::shared_ptr> ops_;