ide: add TRIM support

Add support for TRIM sub function of the data set management command,
and wire it up to the qemu discard infrastructure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Christoph Hellwig 2011-05-19 10:58:19 +02:00 committed by Kevin Wolf
parent 4e1e00515e
commit d353fb72f5
5 changed files with 124 additions and 5 deletions

View file

@ -125,6 +125,11 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
const char *serial;
DriveInfo *dinfo;
if (dev->conf.discard_granularity && dev->conf.discard_granularity != 512) {
error_report("discard_granularity must be 512 for ide");
return -1;
}
serial = dev->serial;
if (!serial) {
/* try to fall back to value set with legacy -drive serial=... */