liblp: Reclaim wasted space from unaligned partitions.
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 round up extents to the optimal alignment. This means partitions may wind up slightly over-allocated, versus before, where they would waste space by making it unavailable. Bug: 120434950 Test: liblp_test gtest Change-Id: I555209b301058555526cc4309f7049ae81cf877d
Loading
Please register or sign in to comment