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:
		| @@ -85,6 +85,7 @@ func TestPoolDevice(t *testing.T) { | ||||
| 		RootPath:           tempDir, | ||||
| 		BaseImageSize:      "16mb", | ||||
| 		BaseImageSizeBytes: 16 * 1024 * 1024, | ||||
| 		DiscardBlocks:      true, | ||||
| 	} | ||||
|  | ||||
| 	pool, err := NewPoolDevice(ctx, config) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kern Walster
					Kern Walster