ia64/xen-unstable

changeset 818:d5e8cbd474a3

bitkeeper revision 1.503 (3f87bb888GFs_glucvd8TfB69He-BQ)

Manual merge
author kaf24@scramble.cl.cam.ac.uk
date Sat Oct 11 08:12:56 2003 +0000 (2003-10-11)
parents 399bb8faf92a 18051e617fea
children 3c65c1356225
files .rootkeys extras/mini-os/Makefile tools/control/src/org/xenoserver/control/CommandVbdList.java tools/misc/Makefile tools/misc/xen_refresh_dev.c xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c
line diff
     1.1 --- a/.rootkeys	Fri Oct 10 19:27:08 2003 +0000
     1.2 +++ b/.rootkeys	Sat Oct 11 08:12:56 2003 +0000
     1.3 @@ -186,6 +186,7 @@ 3f870808zS6T6iFhqYPGelroZlVfGQ tools/mis
     1.4  3f13d81eQ9Vz-h-6RDGFkNR9CRP95g tools/misc/xen_nat_enable
     1.5  3f13d81e6Z6806ihYYUw8GVKNkYnuw tools/misc/xen_nat_enable.README
     1.6  3f1668d4F29Jsw0aC0bJEIkOBiagiQ tools/misc/xen_read_console.c
     1.7 +3f87ba90EUVPQLVOlFG0sW89BCwouQ tools/misc/xen_refresh_dev.c
     1.8  3f72f1bdJPsV3JCnBqs9ddL9tr6D2g xen/COPYING
     1.9  3f841450eJvqAD1Dldc0_aOweGiglQ xen/GUEST_CHANGES
    1.10  3ddb79bcbOVHh38VJzc97-JEGD4dJQ xen/Makefile
     2.1 --- a/extras/mini-os/Makefile	Fri Oct 10 19:27:08 2003 +0000
     2.2 +++ b/extras/mini-os/Makefile	Sat Oct 11 08:12:56 2003 +0000
     2.3 @@ -35,6 +35,7 @@ hypervisor-ifs:
     2.4  clean:
     2.5  	find . -type f -name '*.o' | xargs rm -f
     2.6  	rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz
     2.7 +	find . -type l | xargs rm -f
     2.8  
     2.9  %.o: %.c $(HDRS) Makefile
    2.10  	$(CC) $(CFLAGS) -c $< -o $@
     3.1 --- a/tools/control/src/org/xenoserver/control/CommandVbdList.java	Fri Oct 10 19:27:08 2003 +0000
     3.2 +++ b/tools/control/src/org/xenoserver/control/CommandVbdList.java	Sat Oct 11 08:12:56 2003 +0000
     3.3 @@ -35,7 +35,7 @@ public class CommandVbdList extends Comm
     3.4                      key = st.nextToken();
     3.5                  }
     3.6                  if (st.hasMoreTokens()) {
     3.7 -                    if (Integer.parseInt(st.nextToken()) == 2) {
     3.8 +                    if (Integer.parseInt(st.nextToken()) == 1) {
     3.9                          mode = Mode.READ_WRITE;
    3.10                      }
    3.11                  }
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tools/misc/xen_refresh_dev.c	Sat Oct 11 08:12:56 2003 +0000
     5.3 @@ -0,0 +1,49 @@
     5.4 +/******************************************************************************
     5.5 + * xen_refresh_dev.c
     5.6 + * 
     5.7 + * Refresh our view of a block device by rereading its partition table. This 
     5.8 + * is necessary to synchronise with VBD attaches and unattaches in Xen. 
     5.9 + * Currently there's no automatic plumbing of attach/unattach requests.
    5.10 + * 
    5.11 + * Copyright (c) 2003, K A Fraser
    5.12 + */
    5.13 +
    5.14 +#include <stdio.h>
    5.15 +#include <stdlib.h>
    5.16 +#include <sys/ioctl.h>
    5.17 +#include <sys/stat.h>
    5.18 +#include <sys/types.h>
    5.19 +#include <fcntl.h>
    5.20 +#include <string.h>
    5.21 +#include <errno.h>
    5.22 +#include <unistd.h>
    5.23 +#include <sys/mount.h> /* BLKRRPART */
    5.24 +
    5.25 +int main(int argc, char **argv)
    5.26 +{
    5.27 +    int fd;
    5.28 +
    5.29 +    if ( argc != 2 )
    5.30 +    {
    5.31 +        fprintf(stderr, "xen_refresh_dev <blkdev>\ne.g., /dev/xvda\n");
    5.32 +        return 1;
    5.33 +    }
    5.34 +
    5.35 +    if ( (fd = open(argv[1], O_RDWR)) == -1 )
    5.36 +    {
    5.37 +        fprintf(stderr, "Error opening %s: %s (%d)\n",
    5.38 +                argv[1], strerror(errno), errno);
    5.39 +        return 1;
    5.40 +    }
    5.41 +
    5.42 +    if ( ioctl(fd, BLKRRPART) == -1 )
    5.43 +    {
    5.44 +        fprintf(stderr, "Error executing BLKRRPART on %s: %s (%d)\n",
    5.45 +                argv[1], strerror(errno), errno);
    5.46 +        return 1;
    5.47 +    }
    5.48 +
    5.49 +    close(fd);
    5.50 +
    5.51 +    return 0;
    5.52 +}
     6.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c	Fri Oct 10 19:27:08 2003 +0000
     6.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c	Sat Oct 11 08:12:56 2003 +0000
     6.3 @@ -272,11 +272,9 @@ int xenolinux_block_revalidate(kdev_t de
     6.4      struct gendisk *gd = xldev_to_gendisk(dev);
     6.5      xl_disk_t *disk = xldev_to_xldisk(dev);
     6.6      unsigned long flags;
     6.7 -    int i, partn_shift = PARTN_SHIFT(dev);
     6.8 -    int xdev = dev & XENDEV_IDX_MASK;
     6.9 +    int i, partn_shift = PARTN_SHIFT(dev), disk_nr = MINOR(dev) >> partn_shift;
    6.10      
    6.11 -    DPRINTK("xenolinux_block_revalidate: %d %d %d\n", 
    6.12 -	    dev, xdev, XENDEV_IDX_MASK);
    6.13 +    DPRINTK("xenolinux_block_revalidate: %d\n", dev);
    6.14  
    6.15      spin_lock_irqsave(&io_request_lock, flags);
    6.16      if ( disk->usage > 1 )
    6.17 @@ -286,14 +284,32 @@ int xenolinux_block_revalidate(kdev_t de
    6.18      }
    6.19      spin_unlock_irqrestore(&io_request_lock, flags);
    6.20  
    6.21 -    for ( i = 0; i < (1 << partn_shift); i++ )
    6.22 +    for ( i = (1 << partn_shift) - 1; i >= 0; i-- )
    6.23      {
    6.24 -        invalidate_device(xdev + i, 1);
    6.25 -        gd->part[xdev + i].start_sect = 0;
    6.26 -        gd->part[xdev + i].nr_sects = 0;
    6.27 +        invalidate_device(dev+i, 1);
    6.28 +        gd->part[MINOR(dev+i)].start_sect = 0;
    6.29 +        gd->part[MINOR(dev+i)].nr_sects = 0;
    6.30      }
    6.31  
    6.32 -    grok_partitions(gd, MINOR(dev) >> partn_shift,
    6.33 +    /* VBDs can change under our feet. Check if that has happened. */
    6.34 +    if ( MAJOR(dev) == XLVIRT_MAJOR )
    6.35 +    {
    6.36 +        xen_disk_info_t *xdi = kmalloc(sizeof(*xdi), GFP_KERNEL);
    6.37 +        if ( xdi != NULL )
    6.38 +        {
    6.39 +            memset(xdi, 0, sizeof(*xdi));
    6.40 +            xenolinux_control_msg(XEN_BLOCK_PROBE_SEG, 
    6.41 +                                  (char *)xdi, sizeof(*xdi));
    6.42 +            for ( i = 0; i < xdi->count; i++ )
    6.43 +                if ( IS_VIRTUAL_XENDEV(xdi->disks[i].device) &&
    6.44 +                     ((xdi->disks[i].device & XENDEV_IDX_MASK) == disk_nr) )
    6.45 +                    ((xl_disk_t *)gd->real_devices)[disk_nr].capacity =
    6.46 +                        xdi->disks[i].capacity;
    6.47 +            kfree(xdi);
    6.48 +        }
    6.49 +    }
    6.50 +
    6.51 +    grok_partitions(gd, disk_nr,
    6.52                      1 << partn_shift, disk->capacity);
    6.53  
    6.54      return 0;