summaryrefslogtreecommitdiff
path: root/drivers/block/xen-blkback
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2014-05-21 18:32:42 +0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2014-05-28 22:17:28 +0400
commitc926b701fede80ecd6f68887d5485bb620758721 (patch)
treea12507e65eab2908a84a91cc44e8d448b570bc62 /drivers/block/xen-blkback
parent1c8cad6c1bbcacc07332539f2d7dee22521f9ae0 (diff)
downloadlinux-c926b701fede80ecd6f68887d5485bb620758721.tar.xz
xen/blkback: disable discard feature if requested by toolstack
Newer toolstacks may provide a boolean property "discard-enable" in the backend node. Its purpose is to disable discard for file backed storage to avoid fragmentation. Recognize this setting also for physical storage. If that property exists and is false, do not advertise "feature-discard" to the frontend. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block/xen-blkback')
-rw-r--r--drivers/block/xen-blkback/xenbus.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 9a547e6b6ebf..a71ecf5f4283 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -481,10 +481,15 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
struct xenbus_device *dev = be->dev;
struct xen_blkif *blkif = be->blkif;
int err;
- int state = 0;
+ int state = 0, discard_enable;
struct block_device *bdev = be->blkif->vbd.bdev;
struct request_queue *q = bdev_get_queue(bdev);
+ err = xenbus_scanf(XBT_NIL, dev->nodename, "discard-enable", "%d",
+ &discard_enable);
+ if (err == 1 && !discard_enable)
+ return;
+
if (blk_queue_discard(q)) {
err = xenbus_printf(xbt, dev->nodename,
"discard-granularity", "%u",