From f31352041bdde436c3f6d07e1525a42e48dec215 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Wed, 7 May 2014 13:40:04 +0000 Subject: xen_disk: add discard support Implement discard support for xen_disk. It makes use of the existing discard code in qemu. The discard support is enabled unconditionally. The tool stack may provide a property "discard-enable" in the backend node to optionally disable discard support. This is helpful in case the backing file was intentionally created non-sparse to avoid fragmentation. Signed-off-by: Olaf Hering Signed-off-by: Stefano Stabellini --- include/hw/xen/xen_common.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/hw/xen/xen_common.h') diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 2d5a25bf40..07731b9289 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -144,6 +144,13 @@ static inline int xen_xc_hvm_inject_msi(XenXC xen_xc, domid_t dom, { return -ENOSYS; } +/* The followings are only to compile op_discard related code on older + * Xen releases. */ +#define BLKIF_OP_DISCARD 5 +struct blkif_request_discard { + uint64_t nr_sectors; + uint64_t sector_number; +}; #else static inline int xen_xc_hvm_inject_msi(XenXC xen_xc, domid_t dom, uint64_t addr, uint32_t data) -- cgit v1.2.3