aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkback/xenbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/xen-blkback/xenbus.c')
-rw-r--r--drivers/block/xen-blkback/xenbus.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 4f66171c6683..b2250265308a 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -118,6 +118,7 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
118 atomic_set(&blkif->drain, 0); 118 atomic_set(&blkif->drain, 0);
119 blkif->st_print = jiffies; 119 blkif->st_print = jiffies;
120 init_waitqueue_head(&blkif->waiting_to_free); 120 init_waitqueue_head(&blkif->waiting_to_free);
121 blkif->persistent_gnts.rb_node = NULL;
121 122
122 return blkif; 123 return blkif;
123} 124}
@@ -673,6 +674,13 @@ again:
673 674
674 xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); 675 xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support);
675 676
677 err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", 1);
678 if (err) {
679 xenbus_dev_fatal(dev, err, "writing %s/feature-persistent",
680 dev->nodename);
681 goto abort;
682 }
683
676 err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", 684 err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu",
677 (unsigned long long)vbd_sz(&be->blkif->vbd)); 685 (unsigned long long)vbd_sz(&be->blkif->vbd));
678 if (err) { 686 if (err) {
@@ -721,6 +729,7 @@ static int connect_ring(struct backend_info *be)
721 struct xenbus_device *dev = be->dev; 729 struct xenbus_device *dev = be->dev;
722 unsigned long ring_ref; 730 unsigned long ring_ref;
723 unsigned int evtchn; 731 unsigned int evtchn;
732 unsigned int pers_grants;
724 char protocol[64] = ""; 733 char protocol[64] = "";
725 int err; 734 int err;
726 735
@@ -750,8 +759,18 @@ static int connect_ring(struct backend_info *be)
750 xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); 759 xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
751 return -1; 760 return -1;
752 } 761 }
753 pr_info(DRV_PFX "ring-ref %ld, event-channel %d, protocol %d (%s)\n", 762 err = xenbus_gather(XBT_NIL, dev->otherend,
754 ring_ref, evtchn, be->blkif->blk_protocol, protocol); 763 "feature-persistent-grants", "%u",
764 &pers_grants, NULL);
765 if (err)
766 pers_grants = 0;
767
768 be->blkif->vbd.feature_gnt_persistent = pers_grants;
769 be->blkif->vbd.overflow_max_grants = 0;
770
771 pr_info(DRV_PFX "ring-ref %ld, event-channel %d, protocol %d (%s) %s\n",
772 ring_ref, evtchn, be->blkif->blk_protocol, protocol,
773 pers_grants ? "persistent grants" : "");
755 774
756 /* Map the shared frame, irq etc. */ 775 /* Map the shared frame, irq etc. */
757 err = xen_blkif_map(be->blkif, ring_ref, evtchn); 776 err = xen_blkif_map(be->blkif, ring_ref, evtchn);