aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkfront.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/xen-blkfront.c')
-rw-r--r--drivers/block/xen-blkfront.c44
1 files changed, 16 insertions, 28 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index efe1b4761735..5deb235bd18f 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -612,10 +612,10 @@ static void do_blkif_request(struct request_queue *rq)
612 } 612 }
613 613
614 pr_debug("do_blk_req %p: cmd %p, sec %lx, " 614 pr_debug("do_blk_req %p: cmd %p, sec %lx, "
615 "(%u/%u) buffer:%p [%s]\n", 615 "(%u/%u) [%s]\n",
616 req, req->cmd, (unsigned long)blk_rq_pos(req), 616 req, req->cmd, (unsigned long)blk_rq_pos(req),
617 blk_rq_cur_sectors(req), blk_rq_sectors(req), 617 blk_rq_cur_sectors(req), blk_rq_sectors(req),
618 req->buffer, rq_data_dir(req) ? "write" : "read"); 618 rq_data_dir(req) ? "write" : "read");
619 619
620 if (blkif_queue_request(req)) { 620 if (blkif_queue_request(req)) {
621 blk_requeue_request(rq, req); 621 blk_requeue_request(rq, req);
@@ -1635,36 +1635,24 @@ blkfront_closing(struct blkfront_info *info)
1635static void blkfront_setup_discard(struct blkfront_info *info) 1635static void blkfront_setup_discard(struct blkfront_info *info)
1636{ 1636{
1637 int err; 1637 int err;
1638 char *type;
1639 unsigned int discard_granularity; 1638 unsigned int discard_granularity;
1640 unsigned int discard_alignment; 1639 unsigned int discard_alignment;
1641 unsigned int discard_secure; 1640 unsigned int discard_secure;
1642 1641
1643 type = xenbus_read(XBT_NIL, info->xbdev->otherend, "type", NULL); 1642 info->feature_discard = 1;
1644 if (IS_ERR(type)) 1643 err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1645 return; 1644 "discard-granularity", "%u", &discard_granularity,
1646 1645 "discard-alignment", "%u", &discard_alignment,
1647 info->feature_secdiscard = 0; 1646 NULL);
1648 if (strncmp(type, "phy", 3) == 0) { 1647 if (!err) {
1649 err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1648 info->discard_granularity = discard_granularity;
1650 "discard-granularity", "%u", &discard_granularity, 1649 info->discard_alignment = discard_alignment;
1651 "discard-alignment", "%u", &discard_alignment, 1650 }
1652 NULL); 1651 err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1653 if (!err) { 1652 "discard-secure", "%d", &discard_secure,
1654 info->feature_discard = 1; 1653 NULL);
1655 info->discard_granularity = discard_granularity; 1654 if (!err)
1656 info->discard_alignment = discard_alignment; 1655 info->feature_secdiscard = !!discard_secure;
1657 }
1658 err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1659 "discard-secure", "%d", &discard_secure,
1660 NULL);
1661 if (!err)
1662 info->feature_secdiscard = discard_secure;
1663
1664 } else if (strncmp(type, "file", 4) == 0)
1665 info->feature_discard = 1;
1666
1667 kfree(type);
1668} 1656}
1669 1657
1670static int blkfront_setup_indirect(struct blkfront_info *info) 1658static int blkfront_setup_indirect(struct blkfront_info *info)