libsnapshot: Add discard support for COW devices
When a snapshot is deleted, the underlying COW device is not
discarded. This can lead to space not being reclaimed on the physical
device.
This change adds support for discarding the COW device when a snapshot
is deleted. This is done by calling the BLKDISCARD ioctl on the COW
device, which tells the underlying storage to free the blocks used by
the COW device. This is a best-effort operation, and errors are
ignored.
Bug: 412559168
Test: th, OTA and check for discard messages
Change-Id: I5980215ad3a998ef9bc2f20e5feef805fe3c270e
Signed-off-by:
Sandeep Dhavale <dhavale@google.com>
Loading
Please register or sign in to comment