ia64/xen-unstable

changeset 2035:0a0752383e51

bitkeeper revision 1.1108.33.33 (410e8a32DLC2s_wTAj-ethTgkpaxYg)

clip vbd extents to the size of the underlying device
author cl349@freefall.cl.cam.ac.uk
date Mon Aug 02 18:38:42 2004 +0000 (2004-08-02)
parents ad46030c8989
children 474a697fef95
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 15:44:19 2004 +0000
     1.2 +++ b/linux-2.6.7-xen-sparse/drivers/xen/blkback/vbd.c	Mon Aug 02 18:38:42 2004 +0000
     1.3 @@ -81,9 +81,7 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
     1.4      vbd_t              *vbd = NULL;
     1.5      struct rb_node     *rb;
     1.6      blkif_vdev_t        vdevice = grow->vdevice;
     1.7 -#if 0
     1.8      unsigned long       sz;
     1.9 -#endif
    1.10  
    1.11  
    1.12      blkif = blkif_find_by_handle(grow->domid, grow->blkif_handle);
    1.13 @@ -127,11 +125,11 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
    1.14      x->extent.device        = grow->extent.device;
    1.15      /* XXXcl see comments at top of open_by_devnum */
    1.16  #if 01
    1.17 +#ifdef DONT_BLKDEV_GET
    1.18      x->bdev = bdget(vbd_map_devnum(x->extent.device));
    1.19 -#ifndef DONT_BLKDEV_GET
    1.20 -    if (x->bdev)
    1.21 -	x->bdev = open_by_devnum(vbd_map_devnum(x->extent.device),
    1.22 -				 vbd->readonly ? FMODE_READ : FMODE_WRITE);
    1.23 +#else
    1.24 +    x->bdev = open_by_devnum(vbd_map_devnum(x->extent.device),
    1.25 +			     vbd->readonly ? FMODE_READ : FMODE_WRITE);
    1.26  #endif
    1.27      if (x->bdev == NULL) {
    1.28  	PRINTK("vbd_grow: device %08x doesn't exist.\n", x->extent.device);
    1.29 @@ -144,17 +142,15 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
    1.30      x->extent.sector_length = grow->extent.sector_length;
    1.31      x->next                 = (blkif_extent_le_t *)NULL;
    1.32  
    1.33 -#if 0
    1.34 -    if( !blk_size[MAJOR(x->extent.device)] )
    1.35 +    if( x->bdev->bd_disk == NULL || x->bdev->bd_part == NULL )
    1.36      {
    1.37          PRINTK("vbd_grow: device %08x doesn't exist.\n", x->extent.device);
    1.38  	grow->status = BLKIF_BE_STATUS_EXTENT_NOT_FOUND;
    1.39  	goto out;
    1.40      }
    1.41      
    1.42 -    /* convert blocks (1KB) to sectors */
    1.43 -    sz = blk_size[MAJOR(x->extent.device)][MINOR(x->extent.device)] * 2;    
    1.44 -#endif
    1.45 +    /* get size in sectors */
    1.46 +    sz = x->bdev->bd_part->nr_sects;
    1.47  
    1.48      if ( x->extent.sector_start > 0 )
    1.49      {
    1.50 @@ -163,7 +159,6 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
    1.51  	goto out;
    1.52      }
    1.53  
    1.54 -#if 0
    1.55      /*
    1.56       * NB. This test assumes sector_start == 0, which is always the case
    1.57       * in Xen 1.3. In fact the whole grow/shrink interface could do with
    1.58 @@ -174,7 +169,6 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
    1.59      
    1.60      DPRINTK("vbd_grow: requested_len %llu actual_len %lu\n", 
    1.61              x->extent.sector_length, sz);
    1.62 -#endif
    1.63  
    1.64      for ( px = &vbd->extents; *px != NULL; px = &(*px)->next ) 
    1.65          continue;