libsnapshot: move header op count setup
Op count should be set before we sync the header. This way subsequence
writers can initialize with the correct op buffer size
Test: cow_api_test
Change-Id: I56a0d747b3f2a1d9d582d8f9d643b81cbdd9b8d7
diff --git a/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp b/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp
index e9e05b0..81ccea9 100644
--- a/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp
+++ b/fs_mgr/libsnapshot/libsnapshot_cow/writer_v3.cpp
@@ -100,6 +100,7 @@
return false;
}
header_.compression_algorithm = *algorithm;
+ header_.op_count_max = options_.op_count_max;
if (parts.size() > 1) {
if (!android::base::ParseUint(parts[1], &compression_.compression_level)) {
@@ -163,7 +164,7 @@
return false;
}
}
- header_.op_count_max = options_.op_count_max;
+
resume_points_ = std::make_shared<std::vector<ResumePoint>>();
if (!Sync()) {