Discard blocks when removing a thin device
dmsetup does not discard blocks when removing a thin device. The unused blocks are reused by the thin-pool, but will remain allocated in the underlying device indefinitely. For loop device backed thin-pools, this results in "lost" disk space in the underlying file system as the blocks remain allocated in the loop device's backing file. This change adds an option, discard_blocks, to the devmapper snapshotter which causes the snapshotter to issue blkdiscard ioctls on the thin device before removal. With this option enabled, loop device setups will see disk space return to the underlying filesystem immediately on exiting a container. Fixes #5691 Signed-off-by: Kern Walster <walster@amazon.com>
This commit is contained in:
@@ -43,6 +43,9 @@ type Config struct {
|
||||
|
||||
// Flag to async remove device using Cleanup() callback in snapshots GC
|
||||
AsyncRemove bool `toml:"async_remove"`
|
||||
|
||||
// Whether to discard blocks when removing a thin device.
|
||||
DiscardBlocks bool `toml:"discard_blocks"`
|
||||
}
|
||||
|
||||
// LoadConfig reads devmapper configuration file from disk in TOML format
|
||||
|
||||
Reference in New Issue
Block a user