Merge changes I2db0e626,Ic69fc2f5 am: ea1f0fa006 am: 0660db3ce3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1559877 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I652ef35daabeafc4086bc70f53ead2c679caa85b
This commit is contained in:
commit
5b0db43af3
1 changed files with 41 additions and 9 deletions
|
|
@ -2130,10 +2130,6 @@ bool SnapshotManager::UnmapCowDevices(LockedFile* lock, const std::string& name)
|
||||||
bool SnapshotManager::UnmapDmUserDevice(const std::string& snapshot_name) {
|
bool SnapshotManager::UnmapDmUserDevice(const std::string& snapshot_name) {
|
||||||
auto& dm = DeviceMapper::Instance();
|
auto& dm = DeviceMapper::Instance();
|
||||||
|
|
||||||
if (!EnsureSnapuserdConnected()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto dm_user_name = GetDmUserCowName(snapshot_name);
|
auto dm_user_name = GetDmUserCowName(snapshot_name);
|
||||||
if (dm.GetState(dm_user_name) == DmDeviceState::INVALID) {
|
if (dm.GetState(dm_user_name) == DmDeviceState::INVALID) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -2144,6 +2140,9 @@ bool SnapshotManager::UnmapDmUserDevice(const std::string& snapshot_name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!EnsureSnapuserdConnected()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!snapuserd_client_->WaitForDeviceDelete(dm_user_name)) {
|
if (!snapuserd_client_->WaitForDeviceDelete(dm_user_name)) {
|
||||||
LOG(ERROR) << "Failed to wait for " << dm_user_name << " control device to delete";
|
LOG(ERROR) << "Failed to wait for " << dm_user_name << " control device to delete";
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2173,12 +2172,44 @@ bool SnapshotManager::MapAllSnapshots(const std::chrono::milliseconds& timeout_m
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UnmapAllSnapshots(lock.get())) {
|
std::vector<std::string> snapshots;
|
||||||
|
if (!ListSnapshots(lock.get(), &snapshots)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t slot = SlotNumberForSlotSuffix(device_->GetOtherSlotSuffix());
|
const auto& opener = device_->GetPartitionOpener();
|
||||||
return MapAllPartitions(lock.get(), device_->GetSuperDevice(slot), slot, timeout_ms);
|
auto slot_suffix = device_->GetOtherSlotSuffix();
|
||||||
|
auto slot_number = SlotNumberForSlotSuffix(slot_suffix);
|
||||||
|
auto super_device = device_->GetSuperDevice(slot_number);
|
||||||
|
auto metadata = android::fs_mgr::ReadMetadata(opener, super_device, slot_number);
|
||||||
|
if (!metadata) {
|
||||||
|
LOG(ERROR) << "MapAllSnapshots could not read dynamic partition metadata for device: "
|
||||||
|
<< super_device;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& snapshot : snapshots) {
|
||||||
|
if (!UnmapPartitionWithSnapshot(lock.get(), snapshot)) {
|
||||||
|
LOG(ERROR) << "MapAllSnapshots could not unmap snapshot: " << snapshot;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateLogicalPartitionParams params = {
|
||||||
|
.block_device = super_device,
|
||||||
|
.metadata = metadata.get(),
|
||||||
|
.partition_name = snapshot,
|
||||||
|
.partition_opener = &opener,
|
||||||
|
.timeout_ms = timeout_ms,
|
||||||
|
};
|
||||||
|
if (!MapPartitionWithSnapshot(lock.get(), std::move(params), SnapshotContext::Mount,
|
||||||
|
nullptr)) {
|
||||||
|
LOG(ERROR) << "MapAllSnapshots failed to map: " << snapshot;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(INFO) << "MapAllSnapshots succeeded.";
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnapshotManager::UnmapAllSnapshots() {
|
bool SnapshotManager::UnmapAllSnapshots() {
|
||||||
|
|
@ -2585,8 +2616,9 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife
|
||||||
// these devices.
|
// these devices.
|
||||||
AutoDeviceList created_devices;
|
AutoDeviceList created_devices;
|
||||||
|
|
||||||
bool use_compression =
|
bool use_compression = IsCompressionEnabled() &&
|
||||||
IsCompressionEnabled() && manifest.dynamic_partition_metadata().vabc_enabled();
|
manifest.dynamic_partition_metadata().vabc_enabled() &&
|
||||||
|
!device_->IsRecovery();
|
||||||
|
|
||||||
PartitionCowCreator cow_creator{
|
PartitionCowCreator cow_creator{
|
||||||
.target_metadata = target_metadata.get(),
|
.target_metadata = target_metadata.get(),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue