direct-io.hg

changeset 1795:a427ad2ca16c

bitkeeper revision 1.1090 (40f580e9uCqs_k5TO6a3XRLpGXSb6g)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/iap10/xeno-clone/xeno.bk
author iap10@labyrinth.cl.cam.ac.uk
date Wed Jul 14 18:52:25 2004 +0000 (2004-07-14)
parents 726a6efbd601 8ea26d879f26
children 7935be64296b
files linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/vbd.c
line diff
     1.1 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/vbd.c	Wed Jul 14 17:36:36 2004 +0000
     1.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/vbd.c	Wed Jul 14 18:52:25 2004 +0000
     1.3 @@ -79,6 +79,8 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
     1.4      vbd_t              *vbd = NULL;
     1.5      rb_node_t          *rb;
     1.6      blkif_vdev_t        vdevice = grow->vdevice;
     1.7 +    struct gendisk     *gd;
     1.8 +    struct hd_struct   *hd;
     1.9  
    1.10      blkif = blkif_find_by_handle(grow->domid, grow->blkif_handle);
    1.11      if ( unlikely(blkif == NULL) )
    1.12 @@ -123,6 +125,35 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
    1.13      x->extent.sector_length = grow->extent.sector_length; 
    1.14      x->next                 = (blkif_extent_le_t *)NULL; 
    1.15  
    1.16 +    gd = get_gendisk(x->extent.device);
    1.17 +
    1.18 +    if (!gd || !gd->part)
    1.19 +    {
    1.20 +        grow->status = BLKIF_BE_STATUS_VBD_NOT_FOUND; 
    1.21 +        DPRINTK("vbd_grow: device %08x doesn't exist.\n", x->extent.device);
    1.22 +        goto out;
    1.23 +    }
    1.24 +
    1.25 +    hd = &gd->part[MINOR(x->extent.device)];
    1.26 +
    1.27 +    if (!hd)
    1.28 +    {
    1.29 +        grow->status = BLKIF_BE_STATUS_VBD_NOT_FOUND; 
    1.30 +        DPRINTK("vbd_grow: HD device %08x doesn't exist.\n", x->extent.device);
    1.31 +        goto out;
    1.32 +    }
    1.33 +
    1.34 +    printk("vbd_grow: requested_len %llu actual_len %lu\n", 
    1.35 +	   x->extent.sector_length,  hd->nr_sects );
    1.36 +
    1.37 +    /* this test assumes sector_start is zero, which in the new
    1.38 +       IO world it always will be -- We need to simpligy the 
    1.39 +       grow/shrink interface as we'll always be deadling with whole
    1.40 +       devices
    1.41 +    */
    1.42 +    if ( x->extent.sector_length > hd->nr_sects )
    1.43 +	x->extent.sector_length = hd->nr_sects;    
    1.44 +
    1.45      for ( px = &vbd->extents; *px != NULL; px = &(*px)->next ) 
    1.46          continue;
    1.47