DO NOT MERGE: libsnapshot: Fix test failures on certain configurations. am: 3f96053b38 am: c287a094af

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2577014

Change-Id: Ib1e9c30043e47d29ffa96e923dd6e27f2db8741b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
David Anderson 2023-05-17 19:58:35 +00:00 committed by Automerger Merge Worker
commit 23b206b92e
4 changed files with 12 additions and 3 deletions

View file

@ -3166,7 +3166,8 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife
<< " writer.GetCowVersion(): " << writer.GetCowVersion(); << " writer.GetCowVersion(): " << writer.GetCowVersion();
bool use_compression = IsCompressionEnabled() && dap_metadata.vabc_enabled() && bool use_compression = IsCompressionEnabled() && dap_metadata.vabc_enabled() &&
!device_->IsRecovery() && cow_format_support; !device_->IsRecovery() && cow_format_support &&
KernelSupportsCompressedSnapshots();
std::string compression_algorithm; std::string compression_algorithm;
if (use_compression) { if (use_compression) {

View file

@ -2760,7 +2760,7 @@ bool IsDaemonRequired() {
return true; return true;
} }
return IsUserspaceSnapshotsEnabled(); return IsUserspaceSnapshotsEnabled() && KernelSupportsCompressedSnapshots();
} }
bool ShouldUseCompression() { bool ShouldUseCompression() {
@ -2770,7 +2770,7 @@ bool ShouldUseCompression() {
if (FLAGS_force_config == "vabc") { if (FLAGS_force_config == "vabc") {
return true; return true;
} }
return IsCompressionEnabled(); return IsCompressionEnabled() && KernelSupportsCompressedSnapshots();
} }
} // namespace snapshot } // namespace snapshot

View file

@ -26,7 +26,9 @@
#include <android-base/properties.h> #include <android-base/properties.h>
#include <android-base/strings.h> #include <android-base/strings.h>
#include <fs_mgr/roots.h> #include <fs_mgr/roots.h>
#include <libdm/dm.h>
using android::dm::DeviceMapper;
using android::dm::kSectorSize; using android::dm::kSectorSize;
using android::fiemap::FiemapStatus; using android::fiemap::FiemapStatus;
using android::fs_mgr::EnsurePathMounted; using android::fs_mgr::EnsurePathMounted;
@ -208,5 +210,10 @@ bool IsDmSnapshotTestingEnabled() {
return android::base::GetBoolProperty("snapuserd.test.dm.snapshots", false); return android::base::GetBoolProperty("snapuserd.test.dm.snapshots", false);
} }
bool KernelSupportsCompressedSnapshots() {
auto& dm = DeviceMapper::Instance();
return dm.GetTargetByName("user", nullptr);
}
} // namespace snapshot } // namespace snapshot
} // namespace android } // namespace android

View file

@ -129,6 +129,7 @@ std::ostream& operator<<(std::ostream& os, const Now&);
void AppendExtent(google::protobuf::RepeatedPtrField<chromeos_update_engine::Extent>* extents, void AppendExtent(google::protobuf::RepeatedPtrField<chromeos_update_engine::Extent>* extents,
uint64_t start_block, uint64_t num_blocks); uint64_t start_block, uint64_t num_blocks);
bool KernelSupportsCompressedSnapshots();
bool IsCompressionEnabled(); bool IsCompressionEnabled();
bool IsUserspaceSnapshotsEnabled(); bool IsUserspaceSnapshotsEnabled();