summaryrefslogtreecommitdiff
path: root/drivers/block/xen-blkfront.c
diff options
context:
space:
mode:
authorK. Y. Srinivasan <ksrinivasan@novell.com>2010-03-11 13:42:26 -0800
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 18:31:27 +0200
commit1fa73be6be65028a7543bba8f14474b42e064a1b (patch)
tree1bd0e5a44c99231afefe53e447bddc4b73d091cb /drivers/block/xen-blkfront.c
parent5d7ed20e822ef82117a4d9928b030fa0247b789d (diff)
xen/front: Propagate changed size of VBDs
Support dynamic resizing of virtual block devices. This patch supports both file backed block devices as well as physical devices that can be dynamically resized on the host side. Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'drivers/block/xen-blkfront.c')
-rw-r--r--drivers/block/xen-blkfront.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 60006b730872..f47b0961fab1 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -930,9 +930,24 @@ static void blkfront_connect(struct blkfront_info *info)
unsigned int binfo;
int err;
- if ((info->connected == BLKIF_STATE_CONNECTED) ||
- (info->connected == BLKIF_STATE_SUSPENDED) )
+ switch (info->connected) {
+ case BLKIF_STATE_CONNECTED:
+ /*
+ * Potentially, the back-end may be signalling
+ * a capacity change; update the capacity.
+ */
+ err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
+ "sectors", "%Lu", &sectors);
+ if (XENBUS_EXIST_ERR(err))
+ return;
+ printk(KERN_INFO "Setting capacity to %Lu\n",
+ sectors);
+ set_capacity(info->gd, sectors);
+
+ /* fall through */
+ case BLKIF_STATE_SUSPENDED:
return;
+ }
dev_dbg(&info->xbdev->dev, "%s:%s.\n",
__func__, info->xbdev->otherend);