71fc3f358b
When allocating a partition with a size that is unaligned (to the optimal alignment), the remaining sectors are wasted since they are never reallocated. This is because the free list is guaranteed to only contain optimally-aligned regions. Unfortunately this means when a partition is resized, we are wasting a small amount of space each time. On a non-A/B device, this could wind up being significant. For example, with an alignment of 512KiB, a 4KiB partition at offset 0 will waste 508KiB of space. The next extent to be allocated by any partition will start at the next 512KiB. To address this, we check if the last extent for a partition can be extended to cover the difference between its last sector and the next optimally aligned sector. We also verify that this region was not allocated to any other partition, and does not appear in the free list, to make sure we're not stealing space that will be used somewhere else. Bug: 120434950 Test: liblp_test gtest Change-Id: I88689889d44a4d2c51e659241918aaf2c064e049 |
||
---|---|---|
.. | ||
include/liblp | ||
Android.bp | ||
builder.cpp | ||
builder_test.cpp | ||
images.cpp | ||
images.h | ||
io_test.cpp | ||
partition_opener.cpp | ||
reader.cpp | ||
reader.h | ||
test_partition_opener.cpp | ||
test_partition_opener.h | ||
utility.cpp | ||
utility.h | ||
utility_test.cpp | ||
writer.cpp | ||
writer.h |