ia64/xen-unstable

changeset 5039:847a499e8b29

bitkeeper revision 1.1484 (428df17f3d8vkbg-YhKA0bSn-ZgbJA)

Manual merge.
author kaf24@firebug.cl.cam.ac.uk
date Fri May 20 14:17:35 2005 +0000 (2005-05-20)
parents 08bcb94afa37 7693dd47436e
children e5ee1635b8ee
files linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c
line diff
     2.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c	Fri May 20 13:34:14 2005 +0000
     2.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c	Fri May 20 14:17:35 2005 +0000
     2.3 @@ -278,15 +278,15 @@ struct gendisk *xlvbd_alloc_gendisk(
     2.4      di->mi = mi;
     2.5      di->xd_device = disk->device;
     2.6  
     2.7 -    /* Full disk rather than a single partition? */
     2.8 -    if ((minor & ((1 << mi->type->partn_shift) - 1)) == 0)
     2.9 +    if ((VDISK_TYPE(disk->info) == VDISK_TYPE_DISK) &&
    2.10 +        ((minor & ((1 << mi->type->partn_shift) - 1)) == 0))
    2.11          nr_minors = 1 << mi->type->partn_shift;
    2.12  
    2.13      gd = alloc_disk(nr_minors);
    2.14      if ( !gd )
    2.15          goto out;
    2.16  
    2.17 -    if ( nr_minors > 1 ) /* full disk? */
    2.18 +    if ((VDISK_TYPE(disk->info) != VDISK_TYPE_DISK) || (nr_minors > 1))
    2.19          sprintf(gd->disk_name, "%s%c", mi->type->diskname,
    2.20                  'a' + mi->index * mi->type->disks_per_major +
    2.21                      (minor >> mi->type->partn_shift));
    2.22 @@ -305,6 +305,12 @@ struct gendisk *xlvbd_alloc_gendisk(
    2.23      if ((xlbd_blk_queue == NULL) && xlvbd_blk_queue_alloc(mi->type))
    2.24              goto out_gendisk;
    2.25  
    2.26 +    if (VDISK_READONLY(disk->info))
    2.27 +        set_disk_ro(gd, 1);
    2.28 +
    2.29 +    if (VDISK_TYPE(disk->info) == VDISK_TYPE_CDROM)
    2.30 +        gd->flags |= GENHD_FL_REMOVABLE | GENHD_FL_CD;
    2.31 +
    2.32      gd->queue = xlbd_blk_queue;
    2.33      add_disk(gd);
    2.34      return gd;
    2.35 @@ -347,24 +353,6 @@ static int xlvbd_device_add(struct list_
    2.36      if (gd == NULL)
    2.37          goto out_bd;
    2.38  
    2.39 -    if (VDISK_READONLY(disk->info))
    2.40 -        set_disk_ro(gd, 1);
    2.41 -
    2.42 -    switch (VDISK_TYPE(disk->info)) {
    2.43 -    case VDISK_TYPE_CDROM:
    2.44 -        gd->flags |= GENHD_FL_REMOVABLE | GENHD_FL_CD;
    2.45 -        break;
    2.46 -    case VDISK_TYPE_FLOPPY: 
    2.47 -    case VDISK_TYPE_TAPE:
    2.48 -        gd->flags |= GENHD_FL_REMOVABLE;
    2.49 -        break;
    2.50 -    case VDISK_TYPE_DISK:
    2.51 -        break;
    2.52 -    default:
    2.53 -        WPRINTK("unknown device type %d\n", VDISK_TYPE(disk->info));
    2.54 -        break;
    2.55 -    }    
    2.56 -
    2.57      list_add(&new->list, list);
    2.58  out_bd:
    2.59      bdput(bd);