[Sheepdog] Reclaim free space using ATA discard

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Tue Apr 13 04:27:17 CEST 2010


On Mon, 12 Apr 2010 12:46:49 +0200
Wido den Hollander <wido at pcextreme.nl> wrote:

> Since kernel version 2.6.33 Linux supports the "discard" commando,
> mainly used by SSD's for their wear-leveling and performance.
> 
> It's also called TRIM: http://en.wikipedia.org/wiki/TRIM
> 
> At the moment only Btrfs and EXT4 support trim/discard, but this could
> be a nice feature for sheepdog.
> 
> If sheepdog reads the "discard" messages from the kernel in the VM you
> could figure out which blocks are free again and shrink the used space
> automatically.

Yeah, I saw Christoph's demonstration that the guest kernel issues a
trim command then qemu's image shrinks on the host. We could do
similar.

The version of qemu that we use now for Sheepdog doesn't notify the
block drivers when the host kernel issues a trim command (or SCSI
equivalents). I'm not sure about the latest version. But when qemu is
ready, then we would work on sheepdog about this feature.



More information about the sheepdog mailing list