All of lore.kernel.org
 help / color / mirror / Atom feed
* Trigger xen_vbd_resize
@ 2013-08-15 16:03 Steve Prochniak
  2013-08-15 17:35 ` Pasi Kärkkäinen
  2013-08-15 20:18 ` Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 4+ messages in thread
From: Steve Prochniak @ 2013-08-15 16:03 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 232 bytes --]

I can see that there is support for dynamically resizing of virtual disks in blockback, but how do I trigger backend_changed->xen_blkif_schedule->xen_vbd_resize() when I use something like dd to expand my file backed storage?

 

[-- Attachment #1.2: Type: text/html, Size: 1457 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Trigger xen_vbd_resize
  2013-08-15 16:03 Trigger xen_vbd_resize Steve Prochniak
@ 2013-08-15 17:35 ` Pasi Kärkkäinen
  2013-08-15 20:18 ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 4+ messages in thread
From: Pasi Kärkkäinen @ 2013-08-15 17:35 UTC (permalink / raw)
  To: Steve Prochniak; +Cc: xen-devel

On Thu, Aug 15, 2013 at 09:03:11AM -0700, Steve Prochniak wrote:
>    I can see that there is support for dynamically resizing of virtual disks
>    in blockback, but how do I trigger
>    backend_changed->xen_blkif_schedule->xen_vbd_resize() when I use something
>    like dd to expand my file backed storage?
> 

Not sure.. online resizing has only been used with LVM volumes in dom0 so far..

-- Pasi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Trigger xen_vbd_resize
  2013-08-15 16:03 Trigger xen_vbd_resize Steve Prochniak
  2013-08-15 17:35 ` Pasi Kärkkäinen
@ 2013-08-15 20:18 ` Konrad Rzeszutek Wilk
       [not found]   ` <169101d2-e506-41a9-ab4e-58a3329ddd10@default>
  1 sibling, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-08-15 20:18 UTC (permalink / raw)
  To: Steve Prochniak; +Cc: xen-devel

On Thu, Aug 15, 2013 at 09:03:11AM -0700, Steve Prochniak wrote:
> I can see that there is support for dynamically resizing of virtual disks in blockback, but how do I trigger backend_changed->xen_blkif_schedule->xen_vbd_resize() when I use something like dd to expand my file backed storage?

That would imply you are using the loop back device. If you look in the
blkback driver you will see that it checks on every request that:

#define vbd_sz(_v)      ((_v)->bdev->bd_part ? \
                         (_v)->bdev->bd_part->nr_sects : \
                          get_capacity((_v)->bdev->bd_disk))

And if you follow get_capacity, you get to:

static inline sector_t get_capacity(struct gendisk *disk)
{
        return disk->part0.nr_sects;
}

Looking in the loop device.. well, I will let you figure this out -
hint: figure_loop_size


> 
>  

> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Trigger xen_vbd_resize
       [not found]   ` <169101d2-e506-41a9-ab4e-58a3329ddd10@default>
@ 2013-08-16 15:19     ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-08-16 15:19 UTC (permalink / raw)
  To: Steve Prochniak; +Cc: xen-devel

On Fri, Aug 16, 2013 at 07:23:53AM -0700, Steve Prochniak wrote:
> The piece that I'm missing comes before all that.  

Adding xen-devel back so that other interested parties can benefit from
this knowledge.

> 
> In dom0, I use dd to expand my disk.img file.  I see that in xen_blkif_schedule we check to see if the disk size changed using vbd_sz as you mentioned.  But how do we get from doing the dd to executing that code path in blkback?
> 
> I see that backend_changed in xenbus will indirectly call xen_blkif_schedule, but nothing about doing a dd in dom0 is going to trigger a callback to backend_changed.  What's the proper way for me to signal this?
> 
> All of the examples of people using dynamically resizing disks that I can find are using LVM, but we are using a simple file.
> 
> disk = ['file:/OVS/OVM_OL6U4_X86_PVM_2GB/System.img,xvda,w',
>         'file:/OVS/OVM_OL6U4_X86_PVM_2GB/Disk.img,xvdb,w']
> 

If you look in the loop.c file you will see this:

        case LOOP_SET_CAPACITY:                                                 
                err = -EPERM;                                                   
                if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN))             
                        err = loop_set_capacity(lo, bdev);                      
                break;                                            

which ends up calling figure_loop_size which calls 
        set_capacity(lo->lo_disk, x);                                           


In blkback there is xen_blkif_schedule which is a thread running
all the time servicing the guest fronted for its I/Os which does:

	     while (!kthread_should_stop()) {                                        
                if (try_to_freeze())                                            
                        continue;                                               
                if (unlikely(vbd->size != vbd_sz(vbd)))                         
                        xen_vbd_resize(blkif);                

Every time there is an request it will trigger the check to see if it
needs to resize the disk.

Doing a google search for LOOP_SET_CAPACITY tells me that losetup might
have this implemented, and sure enough  in the manpage of losetup you will see:

     Resize loop device:

            losetup -c loopdev



Hopefully this helps.
> Steve 
> 
> -----Original Message-----
> From: Konrad Rzeszutek Wilk 
> Sent: Thursday, August 15, 2013 4:18 PM
> To: Steve Prochniak
> Cc: xen-devel@lists.xensource.com
> Subject: Re: [Xen-devel] Trigger xen_vbd_resize
> 
> On Thu, Aug 15, 2013 at 09:03:11AM -0700, Steve Prochniak wrote:
> > I can see that there is support for dynamically resizing of virtual disks in blockback, but how do I trigger backend_changed->xen_blkif_schedule->xen_vbd_resize() when I use something like dd to expand my file backed storage?
> 
> That would imply you are using the loop back device. If you look in the
> blkback driver you will see that it checks on every request that:
> 
> #define vbd_sz(_v)      ((_v)->bdev->bd_part ? \
>                          (_v)->bdev->bd_part->nr_sects : \
>                           get_capacity((_v)->bdev->bd_disk))
> 
> And if you follow get_capacity, you get to:
> 
> static inline sector_t get_capacity(struct gendisk *disk)
> {
>         return disk->part0.nr_sects;
> }
> 
> Looking in the loop device.. well, I will let you figure this out -
> hint: figure_loop_size
> 
> 
> > 
> >  
> 
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xen.org
> > http://lists.xen.org/xen-devel
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-16 15:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-15 16:03 Trigger xen_vbd_resize Steve Prochniak
2013-08-15 17:35 ` Pasi Kärkkäinen
2013-08-15 20:18 ` Konrad Rzeszutek Wilk
     [not found]   ` <169101d2-e506-41a9-ab4e-58a3329ddd10@default>
2013-08-16 15:19     ` Konrad Rzeszutek Wilk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.