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.
TEST=strace -e trace=file,ioctl shows the device discarding the end of the updated partitions.
4 files changed