... so that an operation can be skipped partially. For example, if
an operation contains blocks:
563412 -> 123456
... then optimized operation is:
5612 -> 1256
Test: update_engine_unittests
Test: apply incremental OTA
Bug: 148623880
In an experiment, this reduces CoW size of an incremental update
package by 200MB (out of 700MB).
Change-Id: I86ca23fd589ddbc84c81318283b5f4e71782a759
snapshotctl merge --logcat --log-to-file
- If --logcat, log to logcat
- If --log-to-file, log to /data/misc/snapshotctl_log/
- If both, log to both
- If none, log to stdout
Test: manually test these 4 cases
Bug: 148818798
Change-Id: I44b52936c0d095867acc6ee781c6bec04f6ebd6b
Now that the class becomes more complicated, move it out
of SnapshotManager.
Also, make it independent of FiemapStatus. libsnapshot and
libfiemap has different return classes.
Test: libsnapshot_test
Change-Id: If340959ba60bcd51c36e2b48f4d11c149ead907a
When there is not enough space on /userdata, CreateUpdateSnapshot
returns SnapshotManager::Return with ErrorCode::NO_SPACE.
Test: libsnapshot_test
Bug: 138808058
Change-Id: If2effe63f6a4324eff8d05d4db4ce98be8190262
... by writing to a temporary file then rename()'ing it
back.
Test: libsnapshot_test
Bug: 144549076
Change-Id: Ide400aff8d67d56d422d0adea3a4f1673ebc9994
To be compliant with lvm, instead of just zeroing the first 32 bit of
the COW device, force to zero the whole first chunk.
Also switch to std::vector to store the zeroes, reducing the stack
growth.
Test: libsnapshot_test
Bug: 139202197
Change-Id: I2d98549528a222d6c27bb566c68477b5ec3add20
Signed-off-by: Alessio Balsini <balsini@google.com>
In recovery, client is responsible for calling
EnsureMetadataMounted before doing (almost) all
operations on SnapshotManager, e.g.
- CancelUpdate() before sideloading
- BeginUpdate() on retrofit Virtual A/B before sideloading
- Finishing merge before flashing
Test: libsnapshot_test
Test: recovery sideload
Bug: 140749209
Change-Id: I1034a7fa74e31b6850896e61e86341239dbf2699
The super partition usually has some empty space even after
the target partitions are created, especially for retrofit
Virtual A/B devices. Use that empty space for COW before taking
up userdata space.
- PartitionCowCreator computes free regions in super partition metadata
and use that space until it is used up. It returns a pair of numbers
(cow_partition_size, cow_file_size) and let SnapshotManager to create
the partition / images with proper sizes.
- A region is considered free iff it is used by NEITHER target NOR
source partitions
- The list is in PartitionCowCreator's return value so that
SnapshotManager can use it as a guide when creating partitions.
- These partitions are created under the group named "cow".
- Avoid mapping COW partitions directly during init first stage
mount. Init only maps them when they are needed by the top-level
device.
- CreateCowImage no longer zero-fills the first 4 bytes of the image.
(See below)
- CreateUpdatePartitions: after creating the snapshot, also maps the COW
devices (via MapCowDevices()) and zero-fills the first 4 bytes of the
top-level COW device.
- Add a new SnapshotManager::MapCowDevices() function, which maps both
the COW partition (in super) and the COW image (through
IImageManager) (if necessary). Then, create a dm-linear target that
concatenates them (if necessary).
- Add a new SnapshotManager::UnmapCowDevices() functions that does the
reverse MapCowDevices().
- DeleteSnapshot also unmaps the top-level COW device and COW partition
before unmapping the COW images (before deleting them).
Test: libsnapshot_test
Change-Id: I0098b7e842ab48b0b4dd2a59142098b098d23d34
Add CreateCowForUpdate / MapSnapshotDevicesForUpdate
that update_engine and init can call them directly.
Bug: 134536978
Test: libsnapshot_test
Change-Id: If53c48855931db27454fd2893745915c77fd37f8
When we run MapPartitionWithSnapshot, intermediate devices aren't
cleaned up if the call fails. Hence, record these intermediate devices
we have created along the way using the new AutoDevices class. Upon
failure, the AutoDevices object will be destroyed, and all the
intermediate devices will be deleted from device mapper or image
manager. Upon success, AutoDevices::Release() makes sure the
intermediate devices aren't deleted.
Test: libsnapshot_test
Change-Id: Iff4c1297528288a27765c0224b67254b68c89776