summaryrefslogtreecommitdiff
path: root/libsparse/sparse_fuzzer.cpp
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2019-08-27 14:25:31 -0700
committerYifan Hong <elsk@google.com>2019-09-11 18:32:57 -0700
commit20a23bb41c7ec59ff416eebf3a3012e79baef10c (patch)
treedc325a72651df5dd32f2e49e26a25e0ecb8ee8df /libsparse/sparse_fuzzer.cpp
parentc69029f2a8f64a28a47d60204c93c1f77356c493 (diff)
libsnapshot: Also use empty space in super for COW
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
Diffstat (limited to 'libsparse/sparse_fuzzer.cpp')
0 files changed, 0 insertions, 0 deletions