ia64/xen-unstable

changeset 816:d94d0518b17a

bitkeeper revision 1.501.1.1 (3f87b9c8EzBW2E02feJeTxpF8raA7Q)

xl_block.c, Makefile, CommandVbdList.java:
Fix attach of vbds to an already running guest. Created xen_refresh_dev for this purpose.
author kaf24@scramble.cl.cam.ac.uk
date Sat Oct 11 08:05:28 2003 +0000 (2003-10-11)
parents f103c0647208
children 18051e617fea
files tools/control/src/org/xenoserver/control/CommandVbdList.java tools/misc/Makefile xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c
line diff
     1.1 --- a/tools/control/src/org/xenoserver/control/CommandVbdList.java	Fri Oct 10 16:46:06 2003 +0000
     1.2 +++ b/tools/control/src/org/xenoserver/control/CommandVbdList.java	Sat Oct 11 08:05:28 2003 +0000
     1.3 @@ -35,7 +35,7 @@ public class CommandVbdList extends Comm
     1.4                      key = st.nextToken();
     1.5                  }
     1.6                  if (st.hasMoreTokens()) {
     1.7 -                    if (Integer.parseInt(st.nextToken()) == 2) {
     1.8 +                    if (Integer.parseInt(st.nextToken()) == 1) {
     1.9                          mode = Mode.READ_WRITE;
    1.10                      }
    1.11                  }
     2.1 --- a/tools/misc/Makefile	Fri Oct 10 16:46:06 2003 +0000
     2.2 +++ b/tools/misc/Makefile	Sat Oct 11 08:05:28 2003 +0000
     2.3 @@ -7,7 +7,7 @@ HDRS     = $(wildcard *.h)
     2.4  SRCS     = $(wildcard *.c)
     2.5  OBJS     = $(patsubst %.c,%.o,$(SRCS))
     2.6  
     2.7 -TARGETS  = xen_read_console 
     2.8 +TARGETS  = xen_read_console xen_refresh_dev
     2.9  
    2.10  INSTALL  = $(TARGETS) xen-mkdevnodes xen-clone
    2.11  
     3.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c	Fri Oct 10 16:46:06 2003 +0000
     3.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c	Sat Oct 11 08:05:28 2003 +0000
     3.3 @@ -272,11 +272,9 @@ int xenolinux_block_revalidate(kdev_t de
     3.4      struct gendisk *gd = xldev_to_gendisk(dev);
     3.5      xl_disk_t *disk = xldev_to_xldisk(dev);
     3.6      unsigned long flags;
     3.7 -    int i, partn_shift = PARTN_SHIFT(dev);
     3.8 -    int xdev = dev & XENDEV_IDX_MASK;
     3.9 +    int i, partn_shift = PARTN_SHIFT(dev), disk_nr = MINOR(dev) >> partn_shift;
    3.10      
    3.11 -    DPRINTK("xenolinux_block_revalidate: %d %d %d\n", 
    3.12 -	    dev, xdev, XENDEV_IDX_MASK);
    3.13 +    DPRINTK("xenolinux_block_revalidate: %d\n", dev);
    3.14  
    3.15      spin_lock_irqsave(&io_request_lock, flags);
    3.16      if ( disk->usage > 1 )
    3.17 @@ -286,14 +284,32 @@ int xenolinux_block_revalidate(kdev_t de
    3.18      }
    3.19      spin_unlock_irqrestore(&io_request_lock, flags);
    3.20  
    3.21 -    for ( i = 0; i < (1 << partn_shift); i++ )
    3.22 +    for ( i = (1 << partn_shift) - 1; i >= 0; i-- )
    3.23      {
    3.24 -        invalidate_device(xdev + i, 1);
    3.25 -        gd->part[xdev + i].start_sect = 0;
    3.26 -        gd->part[xdev + i].nr_sects = 0;
    3.27 +        invalidate_device(dev+i, 1);
    3.28 +        gd->part[MINOR(dev+i)].start_sect = 0;
    3.29 +        gd->part[MINOR(dev+i)].nr_sects = 0;
    3.30      }
    3.31  
    3.32 -    grok_partitions(gd, MINOR(dev) >> partn_shift,
    3.33 +    /* VBDs can change under our feet. Check if that has happened. */
    3.34 +    if ( MAJOR(dev) == XLVIRT_MAJOR )
    3.35 +    {
    3.36 +        xen_disk_info_t *xdi = kmalloc(sizeof(*xdi), GFP_KERNEL);
    3.37 +        if ( xdi != NULL )
    3.38 +        {
    3.39 +            memset(xdi, 0, sizeof(*xdi));
    3.40 +            xenolinux_control_msg(XEN_BLOCK_PROBE_SEG, 
    3.41 +                                  (char *)xdi, sizeof(*xdi));
    3.42 +            for ( i = 0; i < xdi->count; i++ )
    3.43 +                if ( IS_VIRTUAL_XENDEV(xdi->disks[i].device) &&
    3.44 +                     ((xdi->disks[i].device & XENDEV_IDX_MASK) == disk_nr) )
    3.45 +                    ((xl_disk_t *)gd->real_devices)[disk_nr].capacity =
    3.46 +                        xdi->disks[i].capacity;
    3.47 +            kfree(xdi);
    3.48 +        }
    3.49 +    }
    3.50 +
    3.51 +    grok_partitions(gd, disk_nr,
    3.52                      1 << partn_shift, disk->capacity);
    3.53  
    3.54      return 0;