From: Ian Jackson Subject: Re: [PATCH 08/11] libxl: add option for discard support to xl disk configuration Date: Thu, 6 Mar 2014 18:15:17 +0000 Message-ID: <21272.47925.458055.605902@mariner.uk.xensource.com> References: <1394122436-1392-1-git-send-email-olaf@aepfle.de> <1394122436-1392-9-git-send-email-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1394122436-1392-9-git-send-email-olaf@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Olaf Hering Cc: Ian.Campbell@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Olaf Hering writes ("[PATCH 08/11] libxl: add option for discard support to xl disk configuration"): > Handle new option discard=on|off for disk configuration. It is supposed > to disable discard support if file based backing storage was > intentionally created non-sparse to avoid fragmentation of the file. > > The option is a boolean and intended for the backend driver. A new > boolean property "discard-enable" is written to the backend node. An > upcoming patch for qemu will make use of this property. The kernel > blkback driver may be updated as well to disable discard for phy based > backing storage. Thanks. > +discard= > +--------------- ... > +This option is an advisory setting for the backend driver, depending of the > +value, to advertise discard support (TRIM, UNMAP) to the frontend. I think the semantics of this are unclear. Calling it an "advisory" setting doesn't help. The documentation should explicitly explain under what circumstances it might be honoured. > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index 730f6e1..a18929b 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -2192,6 +2192,9 @@ static void device_disk_add(libxl__egc *egc, uint32_t d... > + if (!libxl_defbool_is_default(disk->discard_enable)) > + flexarray_append_pair(back, "discard-enable", > + libxl_defbool_val(disk->discard_enable) ? "1" : "0"); This approach is quite unusual, and arguably wrong. I think it would be better if the default were (essentially) fixed. This would result in discard-enable always being written here. > + * discard-enable > + * Values: 0/1 (boolean) > + * Default Value: 1 > + * > + * This optional property, set by the toolstack, instructs the > + * backend to offer discard to the frontend. If the property > + * is missing the backend should offer discard if the backing > + * storage actually supports it. What should the backend do if the property is set but the backend doesn't support the requested value ? Ian.