platform_system_core/fs_mgr/liblp
David Anderson 71fc3f358b liblp: Reclaim wasted space from unaligned partitions, v2.
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
2019-03-14 12:09:09 -07:00
..
include/liblp liblp: Reclaim wasted space from unaligned partitions, v2. 2019-03-14 12:09:09 -07:00
Android.bp liblp: Enable building on Windows. 2018-11-19 16:20:51 -08:00
builder.cpp liblp: Reclaim wasted space from unaligned partitions, v2. 2019-03-14 12:09:09 -07:00
builder_test.cpp liblp: Reclaim wasted space from unaligned partitions, v2. 2019-03-14 12:09:09 -07:00
images.cpp fastboot: Warn when flashing dynamic partitions in the bootloader. 2018-11-20 12:10:16 -08:00
images.h liblp: Split super.img for retrofit devices. 2018-11-08 14:19:42 -08:00
io_test.cpp liblp: Modify NewForUpdate to accomodate two super partitions. 2018-11-21 17:36:28 +00:00
partition_opener.cpp liblp: Enable building on Windows. 2018-11-19 16:20:51 -08:00
reader.cpp Fixed a few minor nits in liblp 2019-01-10 13:36:59 -08:00
reader.h liblp: Allow automatic slot suffixing of partition names. 2018-11-08 09:51:03 -08:00
test_partition_opener.cpp liblp: Add an abstraction layer for opening partitions. 2018-10-24 14:18:38 -07:00
test_partition_opener.h liblp: Add an abstraction layer for opening partitions. 2018-10-24 14:18:38 -07:00
utility.cpp liblp: BLKROSET 0 prior to FlashPartitionTable 2019-01-09 16:20:33 -08:00
utility.h liblp: BLKROSET 0 prior to FlashPartitionTable 2019-01-09 16:20:33 -08:00
utility_test.cpp liblp: Allow automatic slot suffixing of partition names. 2018-11-08 09:51:03 -08:00
writer.cpp Merge "Fixed a few minor nits in liblp" 2019-01-20 07:55:47 +00:00
writer.h liblp: Add an abstraction layer for opening partitions. 2018-10-24 14:18:38 -07:00