aboutsummaryrefslogtreecommitdiffstats
path: root/linux-2.6.11-xen-sparse
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-05-20 14:17:35 +0000
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-05-20 14:17:35 +0000
commit32a640dbd513fae2c7579ffc834126ebc7f00fc2 (patch)
tree156e85d33e8c39c30d337a54100c07cdfa315775 /linux-2.6.11-xen-sparse
parent35dad279d71d8f5efa1b8b0209c115ad05656f01 (diff)
parent186965e1ed510a3f2883ac3f4826bf4e382010d2 (diff)
downloadxen-32a640dbd513fae2c7579ffc834126ebc7f00fc2.tar.gz
xen-32a640dbd513fae2c7579ffc834126ebc7f00fc2.tar.bz2
xen-32a640dbd513fae2c7579ffc834126ebc7f00fc2.zip
bitkeeper revision 1.1484 (428df17f3d8vkbg-YhKA0bSn-ZgbJA)
Manual merge.
Diffstat (limited to 'linux-2.6.11-xen-sparse')
-rw-r--r--linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c
index 0110d11223..9a33656469 100644
--- a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c
+++ b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c
@@ -278,15 +278,15 @@ struct gendisk *xlvbd_alloc_gendisk(
di->mi = mi;
di->xd_device = disk->device;
- /* Full disk rather than a single partition? */
- if ((minor & ((1 << mi->type->partn_shift) - 1)) == 0)
+ if ((VDISK_TYPE(disk->info) == VDISK_TYPE_DISK) &&
+ ((minor & ((1 << mi->type->partn_shift) - 1)) == 0))
nr_minors = 1 << mi->type->partn_shift;
gd = alloc_disk(nr_minors);
if ( !gd )
goto out;
- if ( nr_minors > 1 ) /* full disk? */
+ if ((VDISK_TYPE(disk->info) != VDISK_TYPE_DISK) || (nr_minors > 1))
sprintf(gd->disk_name, "%s%c", mi->type->diskname,
'a' + mi->index * mi->type->disks_per_major +
(minor >> mi->type->partn_shift));
@@ -305,6 +305,12 @@ struct gendisk *xlvbd_alloc_gendisk(
if ((xlbd_blk_queue == NULL) && xlvbd_blk_queue_alloc(mi->type))
goto out_gendisk;
+ if (VDISK_READONLY(disk->info))
+ set_disk_ro(gd, 1);
+
+ if (VDISK_TYPE(disk->info) == VDISK_TYPE_CDROM)
+ gd->flags |= GENHD_FL_REMOVABLE | GENHD_FL_CD;
+
gd->queue = xlbd_blk_queue;
add_disk(gd);
return gd;
@@ -347,24 +353,6 @@ static int xlvbd_device_add(struct list_head *list, vdisk_t *disk)
if (gd == NULL)
goto out_bd;
- if (VDISK_READONLY(disk->info))
- set_disk_ro(gd, 1);
-
- switch (VDISK_TYPE(disk->info)) {
- case VDISK_TYPE_CDROM:
- gd->flags |= GENHD_FL_REMOVABLE | GENHD_FL_CD;
- break;
- case VDISK_TYPE_FLOPPY:
- case VDISK_TYPE_TAPE:
- gd->flags |= GENHD_FL_REMOVABLE;
- break;
- case VDISK_TYPE_DISK:
- break;
- default:
- WPRINTK("unknown device type %d\n", VDISK_TYPE(disk->info));
- break;
- }
-
list_add(&new->list, list);
out_bd:
bdput(bd);