Discard the tail of the target partitions when updating.
The partition is normally way bigger than the data it holds and the
remainder of the partition is often ignored by the system. This patch
discards the tail of the partition, past the end of the updated data.
This would ensure that the unused blocks in these partitions can be
reallocated by the SSD controller to other blocks, and that data from
previous updates does not interfere with the current version.
Bug: 28744609
TEST=strace -e trace=file,ioctl shows the device discarding the end of the updated partitions.
Change-Id: Ie6135ee1aef2fa594c40d84af4d1d46a8f53cc3a
4 files changed