: Support dynamic resizing of vbds
PATCH 1/1 : Support dynamic resizing of vbds
The attached patch supports dynamic resizing of vbds. This patch fixes a bug in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.
Subject: Propagate changed size of VBDs
References: bnc#583677
Patch-mainline: n/a
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.
drivers/xen/blkback/blkback.c +3 -0
@@ -209,6 +209,7 @@ static void print_stats(blkif_t *blkif)int blkif_schedule (void *arg) {blkif_t *blkif = arg; +struct vbd *vbd = &blkif->vbd;blkif_get (blkif);
@@ -218,6 +219,8 @@ int blkif_schedule(void *arg)while (!kthread_should_stop ()) {if (try_to_freeze ())continue ; +if (unlikely (vbd->size !=vbd_size (vbd))) +vbd_resize (blkif); wait_event_interruptible( blkif->wq,
drivers/xen/blkback/vbd.c +43 -0
52 lines not on this page · raw message
drivers/xen/blkback/common.h +2 -0
@@ -56,6 +56,7 @@ struct vbd {unsigned char type;/* VDISK_xxx */ u32 pdevice;/* phys device that this vbd maps to */ struct block_device *bdev; +sector_t size;/* Cached size parameter */ };struct backend_info ;
@@ -116,6 +117,7 @@ blkif_t *blkif_alloc(domid_t domid);void blkif_disconnect (blkif_t *blkif);void blkif_free (blkif_t *blkif);int blkif_map (blkif_t *blkif,unsigned long shared_page,unsigned int evtchn); +void vbd_resize (blkif_t *blkif);#define blkif_get (_b) (atomic_inc(&(_b)->refcnt))#define blkif_put (_b) \
drivers/xen/blkfront/blkfront.c +18 -2
@@ -328,9 +328,25 @@ static void connect(struct blkfront_infounsigned 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" , §ors); +if (XENBUS_EXIST_ERR (err)) +return ; +printk (KERN_INFO "Setting capacity to %Lu\n" , + sectors); +set_capacity (info->gd, sectors); +revalidate_disk (info->gd); + +/* fall through */ +case BLKIF_STATE_SUSPENDED :return ; + }DPRINTK ("blkfront.c:connect:%s.\n" , info->xbdev->otherend);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · Ky Srinivasan
The attached patch supports dynamic resizing of vbds. This patch fixes a bug in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.
Please send a delta against the previous patch, since it has already been applied.
J
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On 3/18/2010 at 5:01 PM, in message <[email protected]>, Jeremy
Quoted 8 lines · Fitzhardinge
Quoted 1 line · Ky Srinivasan
The attached patch supports dynamic resizing of vbds. This patch fixes a bug
in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.
Quoted 1 line
Please send a delta against the previous patch, since it has already been applied.
I am attaching a new patch that is the delta on the previous one.
Quoted 2 lines
J
drivers/xen/blkfront/blkfront.c +1 -0
@@ -341,6 +341,7 @@ static void connect(struct blkfront_infoprintk (KERN_INFO "Setting capacity to %Lu\n" , sectors);set_capacity (info->gd, sectors); +revalidate_disk (info->gd);/* fall through */ case BLKIF_STATE_SUSPENDED :
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Based on the location of the file patched, it this would seem to be targeted at the 2.6.18 tree, but then 2.6.18 does not have a revalidate_disk() function (introduced only in .28). What's the deal here? Should this perhaps be carried out by open coding in blkfront what .28 does?
Thanks, Jan
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
"Ky Srinivasan" <[email protected]> 18.03.10 22:21 >>>
On 3/18/2010 at 5:01 PM, in message <[email protected]>, Jeremy
Quoted 8 lines · Fitzhardinge
Quoted 1 line · Ky Srinivasan
The attached patch supports dynamic resizing of vbds. This patch fixes a bug
in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.
Quoted 1 line
Please send a delta against the previous patch, since it has already been applied.
I am attaching a new patch that is the delta on the previous one.
Quoted 2 lines
J
Quoted 7 lines · On Monday 22 March 2010 09:47:40 Jan Beulich wrote:
Based on the location of the file patched, it this would seem to be targeted at the 2.6.18 tree, but then 2.6.18 does not have a
revalidate_disk()function (introduced only in .28). What's the deal here? Should this perhaps be carried out by open coding in blkfront what .28 does?Thanks, Jan
Hi Jan,
These patches are based on the Suse Xen-kernel, which are based on the 2.6.30 kernel (or in that range)
This patch applies cleanly to the xen-kernel for Gentoo which is based on 2.6.29.
I haven't managed to test the resizing yet, this is planned for this week.
--
Joost
Quoted 8 lines
Quoted 1 line
Quoted 1 line
"J. Roeleveld" <[email protected]> 22.03.10 10:15 >>>
Quoted 6 lines · On Monday 22 March 2010 09:47:40 Jan Beulich wrote:
Based on the location of the file patched, it this would seem to be targeted at the 2.6.18 tree, but then 2.6.18 does not have a
revalidate_disk()function (introduced only in .28). What's the deal here? Should this perhaps be carried out by open coding in blkfront what .28 does?
Quoted 8 lines
Quoted 1 line
Thanks, Jan
Hi Jan,
These patches are based on the Suse Xen-kernel, which are based on the 2.6.30 kernel (or in that range)
This patch applies cleanly to the xen-kernel for Gentoo which is based on 2.6.29.
I understand that. But if the original patch has an issue, fixed by the subsequently submitted one, then 2.6.18 (and other pre-.28 forward ported kernels that would make use of the original patch) supposedly also suffers from it, and hence also would need a respective fix.
It is btw. not clear to me whether this second patch is supposed to address the problem you reported on March 16th, or whether that issue is still awaiting debugging/resolution.
Jan
Quoted 18 lines · On Monday 22 March 2010 10:23:41 Jan Beulich wrote:
Quoted 9 lines
Quoted 1 line
Quoted 1 line
"J. Roeleveld" <[email protected]> 22.03.10 10:15 >>>
Quoted 6 lines · On Monday 22 March 2010 09:47:40 Jan Beulich wrote:
Based on the location of the file patched, it this would seem to be targeted at the 2.6.18 tree, but then 2.6.18 does not have a
revalidate_disk()function (introduced only in .28). What's the deal here? Should this perhaps be carried out by open coding in blkfront what .28 does?Quoted 8 lines
Quoted 1 line
Thanks, Jan
Hi Jan,
These patches are based on the Suse Xen-kernel, which are based on the 2.6.30 kernel (or in that range)
This patch applies cleanly to the xen-kernel for Gentoo which is based on 2.6.29.
Quoted 4 lines
I understand that. But if the original patch has an issue, fixed by the subsequently submitted one, then 2.6.18 (and other pre-.28 forward ported kernels that would make use of the original patch) supposedly also suffers from it, and hence also would need a respective fix.
True, as this patch uses a function that wasn't introduced before 2.6.28, then the patch would need to be applied to 2.6.28+ or one that has that function back-ported.
Quoted 3 lines
It is btw. not clear to me whether this second patch is supposed to address the problem you reported on March 16th, or whether that issue is still awaiting debugging/resolution.
This patch was issued to also address the issue I reported.
I have not yet managed to test the patch myself due to time-constraints. Unless something else crops up, I should be able to test it tonight/tomorrow.
But I specify "this week" as I never know if anything else comes around till I actually get home.
--
Joost
Quoted 19 lines · J. Roeleveld
Quoted 18 lines · On Monday 22 March 2010 10:23:41 Jan Beulich wrote:
Quoted 17 lines
Quoted 1 line
Quoted 1 line
"J. Roeleveld" <[email protected]> 22.03.10 10:15 >>>
Quoted 7 lines · On Monday 22 March 2010 09:47:40 Jan Beulich wrote:
Based on the location of the file patched, it this would seem to be targeted at the 2.6.18 tree, but then 2.6.18 does not have a
revalidate_disk()function (introduced only in .28). What's the deal here? Should this perhaps be carried out by open coding in blkfront what .28 does?Thanks, Jan
Hi Jan,
These patches are based on the Suse Xen-kernel, which are based on the 2.6.30 kernel (or in that range)
This patch applies cleanly to the xen-kernel for Gentoo which is based on 2.6.29.
Quoted 9 lines
Quoted 4 lines
I understand that. But if the original patch has an issue, fixed by the subsequently submitted one, then 2.6.18 (and other pre-.28 forward ported kernels that would make use of the original patch) supposedly also suffers from it, and hence also would need a respective fix.
True, as this patch uses a function that wasn't introduced before 2.6.28, then the patch would need to be applied to 2.6.28+ or one that has that function back-ported.
RHEL5 2.6.18 kernels do have SCSI online resizing support. Redhat guys backported it for RHEL 5.3 (2.6.18-128).
Grabbing the patches from the latest el5 kernel might help.
-- Pasi
Quoted 7 lines · Jeremy Fitzhardinge
Quoted 2 lines · Ky Srinivasan
The attached patch supports dynamic resizing of vbds. This patch fixes a bug in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.
Please send a delta against the previous patch, since it has already been applied.
Btw dynamic vbd resize is something we should get into mainline Linux..
-- Pasi
Quoted 4 lines · Pasi Kärkkäinen
Quoted 2 lines · Jeremy Fitzhardinge
On 03/18/2010 01:28 PM, Ky Srinivasan wrote:
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
The attached patch supports dynamic resizing of vbds. This patch fixes a bug in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.
Please send a delta against the previous patch, since it has already been applied.
Btw dynamic vbd resize is something we should get into mainline Linux..
Good point. I created a branch called "upstream/blkfront" with a candidate set of blkfront changes to send. Could you test it out?
Thanks,
J
Quoted 12 lines · Jeremy Fitzhardinge
Quoted 11 lines · Pasi Kärkkäinen
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 3 lines · Ky Srinivasan
The attached patch supports dynamic resizing of vbds. This patch fixes a bug in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.
Please send a delta against the previous patch, since it has already been applied.
Quoted 6 lines
Quoted 2 lines
Btw dynamic vbd resize is something we should get into mainline Linux..
Good point. I created a branch called "upstream/blkfront" with a candidate set of blkfront changes to send. Could you test it out?
Sure. I can test it tomorrow.
it seems xen/stable-2.6.32.x branch already has these patches so dom0 side is easy for the test..
should I try the blkfront patches against the latest Linus git tree, or 2.6.34, or ?
-- Pasi
Quoted 19 lines · Pasi Kärkkäinen
Quoted 17 lines · Jeremy Fitzhardinge
Quoted 15 lines · Pasi Kärkkäinen
Quoted 12 lines · Jeremy Fitzhardinge
Quoted 4 lines · Ky Srinivasan
The attached patch supports dynamic resizing of vbds. This patch fixes a bug in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.
Please send a delta against the previous patch, since it has already been applied.
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
Btw dynamic vbd resize is something we should get into mainline Linux..
Good point. I created a branch called "upstream/blkfront" with a candidate set of blkfront changes to send. Could you test it out?
Sure. I can test it tomorrow.
Thanks.
Quoted 5 lines
it seems xen/stable-2.6.32.x branch already has these patches so dom0 side is easy for the test..
should I try the blkfront patches against the latest Linus git tree, or 2.6.34, or ?
That branch, upstream/blkfront, is rebased onto v2.6.34, so you can test it as-is, or merge it into the current linux-2.6 branch (which is a clean merge).
J
Quoted 35 lines · Jeremy Fitzhardinge
Quoted 19 lines · Pasi Kärkkäinen
Quoted 17 lines · Jeremy Fitzhardinge
Quoted 15 lines · Pasi Kärkkäinen
Quoted 12 lines · Jeremy Fitzhardinge
Quoted 4 lines · Ky Srinivasan
The attached patch supports dynamic resizing of vbds. This patch fixes a bug in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.
Please send a delta against the previous patch, since it has already been applied.
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
Btw dynamic vbd resize is something we should get into mainline Linux..
Good point. I created a branch called "upstream/blkfront" with a candidate set of blkfront changes to send. Could you test it out?
Sure. I can test it tomorrow.
Thanks.
Quoted 3 lines
it seems xen/stable-2.6.32.x branch already has these patches so dom0 side is easy for the test..
Quoted 7 lines
Quoted 2 lines
should I try the blkfront patches against the latest Linus git tree, or 2.6.34, or ?
That branch, upstream/blkfront, is rebased onto v2.6.34, so you can test it as-is, or merge it into the current linux-2.6 branch (which is a clean merge).
Ok, I finally got to it.
It seems to work OK for me. I installed Fedora 13 PV guest and updated the kernel to xen.git 'upstream/blkfront' branch (2.6.35-rc4).
Then I added 'xvdb' disk to the guest, which was 4 GB initially. I started the guest and verified disk is 4GB in size from /proc/partitions.
And then in dom0:
# lvextend -L+1G /dev/vg_f13/resizetest2 Extending logical volume resizetest2 to 5.00 GiB Logical volume resizetest2 successfully resized
Nothing in dom0 logs at this point. Nothing in domU logs either. Then I did in the domU:
[root@resizetest1 ~]# fdisk -l /dev/xvdb
Accessing the device caused in domU dmesg:
Setting capacity to 10485760
xvdb: detected capacity change from 4294967296 to 5368709120
xvdb: unknown partition table
[root@resizetest1 ~]# cat /proc/partitions | grep xvdb
202 16 5242880 xvdb
So resizing seemed to work OK.
That also triggered the following in dom0 dmesg:
device vif5.0 entered promiscuous mode
virbr0: topology change detected, propagating
virbr0: port 1(vif5.0) entering forwarding state
blkback: ring-ref 8, event-channel 23, protocol 1 (x86_64-abi)
blkback: ring-ref 9, event-channel 24, protocol 1 (x86_64-abi) vif5.0: no IPv6 routers present
VBD Resize: new size 10485760
-- Pasi
Quoted 7 lines · On Thursday 18 March 2010 21:28:37 Ky Srinivasan wrote:
The attached patch supports dynamic resizing of vbds. This patch fixes a
bug in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.Signed-off-by K. Y. Srinivasan <[email protected]>
Apologies for the delay.
I finally managed to test this and the patch fixes my previous issue.
I was unable to reproduce the freeze I had with the previous patch.
--
Joost Roeleveld
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On 4/4/2010 at 5:57 AM, in message <[email protected]>,
Quoted 6 lines · J. Roeleveld
Quoted 5 lines · On Thursday 18 March 2010 21:28:37 Ky Srinivasan wrote:
The attached patch supports dynamic resizing of vbds. This patch fixes a
bug in the previous version of this patch that was sent out. With this patch you can perform "online" resizing of file systems that support online resizing.
Quoted 7 lines
Quoted 2 lines
Signed-off-by K. Y. Srinivasan <[email protected]>Apologies for the delay.
I finally managed to test this and the patch fixes my previous issue.I was unable to reproduce the freeze I had with the previous patch.
Thanks.
K. Y
Quoted 9 lines
--
Joost Roeleveld_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel