aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkback/blkback.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/xen-blkback/blkback.c')
-rw-r--r--drivers/block/xen-blkback/blkback.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 70caa8969972..73f196ca713f 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -398,21 +398,18 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
398 int err = 0; 398 int err = 0;
399 int status = BLKIF_RSP_OKAY; 399 int status = BLKIF_RSP_OKAY;
400 struct block_device *bdev = blkif->vbd.bdev; 400 struct block_device *bdev = blkif->vbd.bdev;
401 unsigned long secure;
401 402
402 blkif->st_ds_req++; 403 blkif->st_ds_req++;
403 404
404 xen_blkif_get(blkif); 405 xen_blkif_get(blkif);
405 if (blkif->blk_backend_type == BLKIF_BACKEND_PHY || 406 secure = (blkif->vbd.discard_secure &&
406 blkif->blk_backend_type == BLKIF_BACKEND_FILE) { 407 (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ?
407 unsigned long secure = (blkif->vbd.discard_secure && 408 BLKDEV_DISCARD_SECURE : 0;
408 (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ? 409
409 BLKDEV_DISCARD_SECURE : 0; 410 err = blkdev_issue_discard(bdev, req->u.discard.sector_number,
410 err = blkdev_issue_discard(bdev, 411 req->u.discard.nr_sectors,
411 req->u.discard.sector_number, 412 GFP_KERNEL, secure);
412 req->u.discard.nr_sectors,
413 GFP_KERNEL, secure);
414 } else
415 err = -EOPNOTSUPP;
416 413
417 if (err == -EOPNOTSUPP) { 414 if (err == -EOPNOTSUPP) {
418 pr_debug(DRV_PFX "discard op failed, not supported\n"); 415 pr_debug(DRV_PFX "discard op failed, not supported\n");