ia64/xen-unstable

changeset 2027:64ccd65031af

bitkeeper revision 1.1108.33.27 (410e42f6qyec9s4m1W8DMrm75FHbUA)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into freefall.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xeno.bk-26dom0
author cl349@freefall.cl.cam.ac.uk
date Mon Aug 02 13:34:46 2004 +0000 (2004-08-02)
parents eaeb569cef15 ca38a9608848
children 3b0ab2e570a0
files linux-2.6.7-xen-sparse/drivers/xen/blkback/vbd.c
line diff
     1.1 --- a/linux-2.6.7-xen-sparse/drivers/xen/blkback/vbd.c	Mon Aug 02 11:32:07 2004 +0000
     1.2 +++ b/linux-2.6.7-xen-sparse/drivers/xen/blkback/vbd.c	Mon Aug 02 13:34:46 2004 +0000
     1.3 @@ -127,8 +127,17 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
     1.4      x->extent.device        = grow->extent.device;
     1.5      /* XXXcl see comments at top of open_by_devnum */
     1.6  #if 01
     1.7 -    x->bdev = open_by_devnum(vbd_map_devnum(x->extent.device),
     1.8 -			     vbd->readonly ? FMODE_READ : FMODE_WRITE);
     1.9 +    x->bdev = bdget(vbd_map_devnum(x->extent.device));
    1.10 +#ifndef DONT_BLKDEV_GET
    1.11 +    if (x->bdev)
    1.12 +	x->bdev = open_by_devnum(vbd_map_devnum(x->extent.device),
    1.13 +				 vbd->readonly ? FMODE_READ : FMODE_WRITE);
    1.14 +#endif
    1.15 +    if (x->bdev == NULL) {
    1.16 +	PRINTK("vbd_grow: device %08x doesn't exist.\n", x->extent.device);
    1.17 +	grow->status = BLKIF_BE_STATUS_EXTENT_NOT_FOUND;
    1.18 +	goto out;
    1.19 +    }
    1.20  #endif
    1.21      /* XXXcl maybe bd_claim? */
    1.22      x->extent.sector_start  = grow->extent.sector_start;
    1.23 @@ -231,6 +240,11 @@ void vbd_shrink(blkif_be_vbd_shrink_t *s
    1.24  
    1.25      x   = *px;
    1.26      *px = x->next;
    1.27 +
    1.28 +#ifndef DONT_BLKDEV_GET
    1.29 +    blkdev_put(x->bdev);
    1.30 +#endif
    1.31 +
    1.32      kfree(x);
    1.33  
    1.34      shrink->status = BLKIF_BE_STATUS_OKAY;
    1.35 @@ -491,6 +505,15 @@ int vbd_translate(phys_seg_t *pseg, blki
    1.36  #define MAJOR_XEN(dev)	((dev)>>8)
    1.37  #define MINOR_XEN(dev)	((dev) & 0xff)
    1.38  
    1.39 +#ifndef FANCY_REMAPPING
    1.40 +static dev_t vbd_map_devnum(blkif_pdev_t cookie)
    1.41 +{
    1.42 +    int major = MAJOR_XEN(cookie);
    1.43 +    int minor = MINOR_XEN(cookie);
    1.44 +
    1.45 +    return MKDEV(major, minor);
    1.46 +}
    1.47 +#else
    1.48  #define	XEN_IDE0_MAJOR IDE0_MAJOR
    1.49  #define	XEN_IDE1_MAJOR IDE1_MAJOR
    1.50  #define	XEN_IDE2_MAJOR IDE2_MAJOR
    1.51 @@ -538,3 +561,4 @@ static dev_t vbd_map_devnum(blkif_pdev_t
    1.52  
    1.53      return MKDEV(new_major, minor);
    1.54  }
    1.55 +#endif