From a4d1685d2382e423ee4d66a9554454bf1b44f316 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Tue, 13 Mar 2012 18:05:58 -0400 Subject: [PATCH] xen/blkback: Disable DISCARD support for loopback device (but leave for phy). Until we back-port the changes from 3.3 which alter the loopback device to support the full gamma of discard attributes. Otherwise we have to punch through loop device to retrieve the underlaying disk size and do other nasty things to get the proper information. Also there is the outstanding issue that Logical Volumes won't pass through the DISCARD support, so in most cases we can't take advantage of this code until that gets fixed. Fixes Oracle BZ#13779884 Signed-off-by: Konrad Rzeszutek Wilk --- drivers/block/xen-blkback/xenbus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 9e9c8a1fc06c..52ae86cee642 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -397,7 +397,11 @@ int xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be) type = xenbus_read(XBT_NIL, dev->nodename, "type", NULL); if (!IS_ERR(type)) { if (strncmp(type, "file", 4) == 0) { - state = 1; + /* For this to work properly (so that discard-* attr + * are propagated to the guest), we should back-port + * loop request_queue discard support. + */ + state = 0; blkif->blk_backend_type = BLKIF_BACKEND_FILE; } if (strncmp(type, "phy", 3) == 0) { -- 2.50.1