ia64/xen-unstable

changeset 5055:8397cf88a855

bitkeeper revision 1.1492 (428e3bd7k7u4q5iZW-q27Jpez3WzGg)

Clean up vbd probing, and include hardware sector size in the probe
information. blkback ensures that all requests are aligned to
hardware sector size and returns error if this is not so.
In blkfront we now have a request_queue per vbd, with hardsect_size
set appropriately.
It is now once again possible to mount a CDROM in a domU.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri May 20 19:34:47 2005 +0000 (2005-05-20)
parents 95c16a18cc65
children 85fcf3b1b7a5
files linux-2.4.29-xen-sparse/arch/xen/drivers/blkif/frontend/vbd.c linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c linux-2.6.11-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6.11-xen-sparse/drivers/xen/blkfront/block.h linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c netbsd-2.0-xen-sparse/sys/arch/xen/xen/xbd.c tools/blktap/parallax-threaded.c tools/blktap/parallax.c xen/include/public/io/blkif.h
line diff
     1.1 --- a/linux-2.4.29-xen-sparse/arch/xen/drivers/blkif/frontend/vbd.c	Fri May 20 19:26:10 2005 +0000
     1.2 +++ b/linux-2.4.29-xen-sparse/arch/xen/drivers/blkif/frontend/vbd.c	Fri May 20 19:34:47 2005 +0000
     1.3 @@ -136,11 +136,6 @@ static int xlvbd_init_device(vdisk_t *xd
     1.4  	major_name = XLSCSI_MAJOR_NAME;
     1.5  	max_part   = XLSCSI_MAX_PART;
     1.6  
     1.7 -    } else if (VDISK_VIRTUAL(xd->info)) {
     1.8 -
     1.9 -	major_name = XLVBD_MAJOR_NAME;
    1.10 -	max_part   = XLVBD_MAX_PART;
    1.11 -
    1.12      } else { 
    1.13  
    1.14          /* SMH: hmm - probably a CCISS driver or sim; assume CCISS for now */
    1.15 @@ -247,8 +242,8 @@ static int xlvbd_init_device(vdisk_t *xd
    1.16          blk_size[major] = gd->sizes;
    1.17      }
    1.18  
    1.19 -    if ( VDISK_READONLY(xd->info) )
    1.20 -        set_device_ro(device, 1); 
    1.21 +    if ( xd->info & VDISK_READONLY )
    1.22 +        set_device_ro(device, 1);
    1.23  
    1.24      gd->flags[minor >> gd->minor_shift] |= GENHD_FL_XEN;
    1.25  
    1.26 @@ -297,20 +292,16 @@ static int xlvbd_init_device(vdisk_t *xd
    1.27          gd->sizes[minor] = capacity>>(BLOCK_SIZE_BITS-9);
    1.28          
    1.29          /* Some final fix-ups depending on the device type */
    1.30 -        switch ( VDISK_TYPE(xd->info) )
    1.31 +        if ( xd->info & VDISK_REMOVABLE )
    1.32          { 
    1.33 -        case VDISK_TYPE_CDROM:
    1.34 -        case VDISK_TYPE_FLOPPY: 
    1.35 -        case VDISK_TYPE_TAPE:
    1.36              gd->flags[minor >> gd->minor_shift] |= GENHD_FL_REMOVABLE; 
    1.37              printk(KERN_ALERT 
    1.38                     "Skipping partition check on %s /dev/%s\n", 
    1.39 -                   VDISK_TYPE(xd->info)==VDISK_TYPE_CDROM ? "cdrom" : 
    1.40 -                   (VDISK_TYPE(xd->info)==VDISK_TYPE_TAPE ? "tape" : 
    1.41 -                    "floppy"), disk_name(gd, MINOR(device), buf)); 
    1.42 -            break; 
    1.43 -
    1.44 -        case VDISK_TYPE_DISK:
    1.45 +                   (xd->info & VDISK_CDROM) ? "cdrom" : "removable",
    1.46 +                   disk_name(gd, MINOR(device), buf)); 
    1.47 +        }
    1.48 +        else
    1.49 +        {
    1.50              /* Only check partitions on real discs (not virtual!). */
    1.51              if ( gd->flags[minor>>gd->minor_shift] & GENHD_FL_VIRT_PARTNS )
    1.52              {
    1.53 @@ -320,12 +311,6 @@ static int xlvbd_init_device(vdisk_t *xd
    1.54                  break;
    1.55              }
    1.56              register_disk(gd, device, gd->max_p, &xlvbd_block_fops, capacity);
    1.57 -            break; 
    1.58 -
    1.59 -        default:
    1.60 -            printk(KERN_ALERT "XenoLinux: unknown device type %d\n", 
    1.61 -                   VDISK_TYPE(xd->info)); 
    1.62 -            break; 
    1.63          }
    1.64      }
    1.65  
     2.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c	Fri May 20 19:26:10 2005 +0000
     2.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c	Fri May 20 19:34:47 2005 +0000
     2.3 @@ -623,6 +623,13 @@ static void dispatch_rw_block_io(blkif_t
     2.4  
     2.5      for ( i = 0; i < nseg; i++ )
     2.6      {
     2.7 +        if ( ((int)preq.sector_number|(int)seg[i].nsec) &
     2.8 +             ((bdev_hardsect_size(preq.bdev) >> 9) - 1) )
     2.9 +        {
    2.10 +            DPRINTK("Misaligned I/O request from domain %d", blkif->domid);
    2.11 +            goto cleanup_and_fail;
    2.12 +        }
    2.13 +
    2.14          while ( (bio == NULL) ||
    2.15                  (bio_add_page(bio,
    2.16                                virt_to_page(MMAP_VADDR(pending_idx, i)),
    2.17 @@ -632,6 +639,7 @@ static void dispatch_rw_block_io(blkif_t
    2.18              bio = biolist[nbio++] = bio_alloc(GFP_KERNEL, nseg-i);
    2.19              if ( unlikely(bio == NULL) )
    2.20              {
    2.21 +            cleanup_and_fail:
    2.22                  for ( i = 0; i < (nbio-1); i++ )
    2.23                      bio_put(biolist[i]);
    2.24                  fast_flush_area(pending_idx, nseg);
     3.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c	Fri May 20 19:26:10 2005 +0000
     3.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c	Fri May 20 19:34:47 2005 +0000
     3.3 @@ -15,7 +15,7 @@
     3.4  struct vbd { 
     3.5      blkif_vdev_t   vdevice;     /* what the domain refers to this vbd as */
     3.6      unsigned char  readonly;    /* Non-zero -> read-only */
     3.7 -    unsigned char  type;        /* VDISK_TYPE_xxx */
     3.8 +    unsigned char  type;        /* VDISK_xxx */
     3.9      blkif_pdev_t   pdevice;     /* phys device that this vbd maps to */
    3.10      struct block_device *bdev;
    3.11      rb_node_t      rb;          /* for linking into R-B tree lookup struct */
    3.12 @@ -30,6 +30,7 @@ static inline dev_t vbd_map_devnum(blkif
    3.13  #else
    3.14  #define vbd_sz(_v)   (blk_size[MAJOR((_v)->pdevice)][MINOR((_v)->pdevice)]*2)
    3.15  #define bdev_put(_b) ((void)0)
    3.16 +#define bdev_hardsect_size(_b) 512
    3.17  #endif
    3.18  
    3.19  void vbd_create(blkif_be_vbd_create_t *create) 
    3.20 @@ -78,6 +79,7 @@ void vbd_create(blkif_be_vbd_create_t *c
    3.21  
    3.22      vbd->vdevice  = vdevice; 
    3.23      vbd->readonly = create->readonly;
    3.24 +    vbd->type     = 0;
    3.25  
    3.26      /* Mask to 16-bit for compatibility with old tools */
    3.27      vbd->pdevice  = create->pdevice & 0xffff;
    3.28 @@ -101,8 +103,11 @@ void vbd_create(blkif_be_vbd_create_t *c
    3.29          return;
    3.30      }
    3.31  
    3.32 -    vbd->type = (vbd->bdev->bd_disk->flags & GENHD_FL_CD) ?
    3.33 -        VDISK_TYPE_CDROM : VDISK_TYPE_DISK;
    3.34 +    if ( vbd->bdev->bd_disk->flags & GENHD_FL_CD )
    3.35 +        vbd->type |= VDISK_CDROM;
    3.36 +    if ( vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE )
    3.37 +        vbd->type |= VDISK_REMOVABLE;
    3.38 +
    3.39  #else
    3.40      if ( (blk_size[MAJOR(vbd->pdevice)] == NULL) || (vbd_sz(vbd) == 0) )
    3.41      {
    3.42 @@ -110,8 +115,6 @@ void vbd_create(blkif_be_vbd_create_t *c
    3.43          create->status = BLKIF_BE_STATUS_PHYSDEV_NOT_FOUND;
    3.44          return;
    3.45      }
    3.46 -
    3.47 -    vbd->type = VDISK_TYPE_DISK;
    3.48  #endif
    3.49  
    3.50      spin_lock(&blkif->vbd_lock);
    3.51 @@ -189,9 +192,10 @@ void destroy_all_vbds(blkif_t *blkif)
    3.52  static void vbd_probe_single(
    3.53      blkif_t *blkif, vdisk_t *vbd_info, struct vbd *vbd)
    3.54  {
    3.55 -    vbd_info->device   = vbd->vdevice; 
    3.56 -    vbd_info->info     = vbd->type | (vbd->readonly ? VDISK_FLAG_RO : 0);
    3.57 -    vbd_info->capacity = vbd_sz(vbd);
    3.58 +    vbd_info->device      = vbd->vdevice; 
    3.59 +    vbd_info->info        = vbd->type | (vbd->readonly ? VDISK_READONLY : 0);
    3.60 +    vbd_info->capacity    = vbd_sz(vbd);
    3.61 +    vbd_info->sector_size = bdev_hardsect_size(vbd->bdev);
    3.62  }
    3.63  
    3.64  
     4.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri May 20 19:26:10 2005 +0000
     4.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri May 20 19:34:47 2005 +0000
     4.3 @@ -193,20 +193,21 @@ static void vbd_update(void)
     4.4  }
     4.5  #endif /* ENABLE_VBD_UPDATE */
     4.6  
     4.7 +static struct xlbd_disk_info *head_waiting = NULL;
     4.8  static void kick_pending_request_queues(void)
     4.9  {
    4.10 -    if ( (xlbd_blk_queue != NULL) &&
    4.11 -         test_bit(QUEUE_FLAG_STOPPED, &xlbd_blk_queue->queue_flags) )
    4.12 +    struct xlbd_disk_info *di;
    4.13 +    while ( ((di = head_waiting) != NULL) && !RING_FULL(&blk_ring) )
    4.14      {
    4.15 -        blk_start_queue(xlbd_blk_queue);
    4.16 -        /* XXXcl call to request_fn should not be needed but
    4.17 -         * we get stuck without...  needs investigating
    4.18 -         */
    4.19 -        xlbd_blk_queue->request_fn(xlbd_blk_queue);
    4.20 +        head_waiting = di->next_waiting;
    4.21 +        di->next_waiting = NULL;
    4.22 +        /* Re-enable calldowns. */
    4.23 +        blk_start_queue(di->rq);
    4.24 +        /* Kick things off immediately. */
    4.25 +        do_blkif_request(di->rq);
    4.26      }
    4.27  }
    4.28  
    4.29 -
    4.30  int blkif_open(struct inode *inode, struct file *filep)
    4.31  {
    4.32      struct gendisk *gd = inode->i_bdev->bd_disk;
    4.33 @@ -277,8 +278,7 @@ int blkif_ioctl(struct inode *inode, str
    4.34   */
    4.35  static int blkif_queue_request(struct request *req)
    4.36  {
    4.37 -    struct xlbd_disk_info *di =
    4.38 -        (struct xlbd_disk_info *)req->rq_disk->private_data;
    4.39 +    struct xlbd_disk_info *di = req->rq_disk->private_data;
    4.40      unsigned long buffer_ma;
    4.41      blkif_request_t *ring_req;
    4.42      struct bio *bio;
    4.43 @@ -353,6 +353,7 @@ static int blkif_queue_request(struct re
    4.44   */
    4.45  void do_blkif_request(request_queue_t *rq)
    4.46  {
    4.47 +    struct xlbd_disk_info *di;
    4.48      struct request *req;
    4.49      int queued;
    4.50  
    4.51 @@ -369,10 +370,7 @@ void do_blkif_request(request_queue_t *r
    4.52          }
    4.53  
    4.54          if ( RING_FULL(&blk_ring) )
    4.55 -        {
    4.56 -            blk_stop_queue(rq);
    4.57 -            break;
    4.58 -        }
    4.59 +            goto wait;
    4.60  
    4.61          DPRINTK("do_blk_req %p: cmd %p, sec %lx, (%u/%li) buffer:%p [%s]\n",
    4.62                  req, req->cmd, req->sector, req->current_nr_sectors,
    4.63 @@ -382,7 +380,15 @@ void do_blkif_request(request_queue_t *r
    4.64          blkdev_dequeue_request(req);
    4.65          if ( blkif_queue_request(req) )
    4.66          {
    4.67 -            blk_stop_queue(rq);
    4.68 +        wait:
    4.69 +            di = req->rq_disk->private_data;
    4.70 +            if ( di->next_waiting == NULL )
    4.71 +            {
    4.72 +                di->next_waiting = head_waiting;
    4.73 +                head_waiting = di;
    4.74 +                /* Avoid pointless unplugs. */
    4.75 +                blk_stop_queue(rq);
    4.76 +            }
    4.77              break;
    4.78          }
    4.79  
    4.80 @@ -451,7 +457,7 @@ static irqreturn_t blkif_int(int irq, vo
    4.81      }
    4.82  
    4.83      blk_ring.rsp_cons = i;
    4.84 -    
    4.85 +
    4.86      kick_pending_request_queues();
    4.87  
    4.88      spin_unlock_irqrestore(&blkif_io_lock, flags);
     5.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/block.h	Fri May 20 19:26:10 2005 +0000
     5.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/block.h	Fri May 20 19:34:47 2005 +0000
     5.3 @@ -90,13 +90,16 @@ struct xlbd_major_info {
     5.4  struct xlbd_disk_info {
     5.5      int xd_device;
     5.6      struct xlbd_major_info *mi;
     5.7 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     5.8 +    struct xlbd_disk_info  *next_waiting;
     5.9 +    request_queue_t        *rq;
    5.10 +#endif
    5.11  };
    5.12  
    5.13  typedef struct xen_block {
    5.14      int usage;
    5.15  } xen_block_t;
    5.16  
    5.17 -extern struct request_queue *xlbd_blk_queue;
    5.18  extern spinlock_t blkif_io_lock;
    5.19  
    5.20  extern int blkif_open(struct inode *inode, struct file *filep);
     6.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c	Fri May 20 19:26:10 2005 +0000
     6.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c	Fri May 20 19:34:47 2005 +0000
     6.3 @@ -87,8 +87,6 @@ static struct xlbd_major_info *major_inf
     6.4  #define MAX_VBDS 64
     6.5  struct list_head vbds_list;
     6.6  
     6.7 -struct request_queue *xlbd_blk_queue = NULL;
     6.8 -
     6.9  #define MAJOR_XEN(dev) ((dev)>>8)
    6.10  #define MINOR_XEN(dev) ((dev) & 0xff)
    6.11  
    6.12 @@ -233,35 +231,33 @@ static struct xlbd_major_info *xlbd_get_
    6.13              xlbd_alloc_major_info(major, minor, index));
    6.14  }
    6.15  
    6.16 -static int xlvbd_blk_queue_alloc(struct xlbd_type_info *type)
    6.17 +static int xlvbd_init_blk_queue(struct gendisk *gd, vdisk_t *disk)
    6.18  {
    6.19 -    xlbd_blk_queue = blk_init_queue(do_blkif_request, &blkif_io_lock);
    6.20 -    if (xlbd_blk_queue == NULL)
    6.21 +    request_queue_t *rq;
    6.22 +
    6.23 +    rq = blk_init_queue(do_blkif_request, &blkif_io_lock);
    6.24 +    if (rq == NULL)
    6.25          return -1;
    6.26  
    6.27 -    elevator_init(xlbd_blk_queue, "noop");
    6.28 -
    6.29 -    /*
    6.30 -    * Turn off barking 'headactive' mode. We dequeue
    6.31 -    * buffer heads as soon as we pass them to back-end
    6.32 -    * driver.
    6.33 -    */
    6.34 -    blk_queue_headactive(xlbd_blk_queue, 0);
    6.35 +    elevator_init(rq, "noop");
    6.36  
    6.37      /* Hard sector size and max sectors impersonate the equiv. hardware. */
    6.38 -    blk_queue_hardsect_size(xlbd_blk_queue, 512);
    6.39 -    blk_queue_max_sectors(xlbd_blk_queue, 512);
    6.40 +    blk_queue_hardsect_size(rq, disk->sector_size);
    6.41 +    blk_queue_max_sectors(rq, 512);
    6.42  
    6.43      /* Each segment in a request is up to an aligned page in size. */
    6.44 -    blk_queue_segment_boundary(xlbd_blk_queue, PAGE_SIZE - 1);
    6.45 -    blk_queue_max_segment_size(xlbd_blk_queue, PAGE_SIZE);
    6.46 +    blk_queue_segment_boundary(rq, PAGE_SIZE - 1);
    6.47 +    blk_queue_max_segment_size(rq, PAGE_SIZE);
    6.48  
    6.49      /* Ensure a merged request will fit in a single I/O ring slot. */
    6.50 -    blk_queue_max_phys_segments(xlbd_blk_queue, BLKIF_MAX_SEGMENTS_PER_REQUEST);
    6.51 -    blk_queue_max_hw_segments(xlbd_blk_queue, BLKIF_MAX_SEGMENTS_PER_REQUEST);
    6.52 +    blk_queue_max_phys_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST);
    6.53 +    blk_queue_max_hw_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST);
    6.54  
    6.55      /* Make sure buffer addresses are sector-aligned. */
    6.56 -    blk_queue_dma_alignment(xlbd_blk_queue, 511);
    6.57 +    blk_queue_dma_alignment(rq, 511);
    6.58 +
    6.59 +    gd->queue = rq;
    6.60 +
    6.61      return 0;
    6.62  }
    6.63  
    6.64 @@ -274,19 +270,20 @@ struct gendisk *xlvbd_alloc_gendisk(
    6.65  
    6.66      di = kmalloc(sizeof(struct xlbd_disk_info), GFP_KERNEL);
    6.67      if (di == NULL)
    6.68 -        goto out;
    6.69 +        return NULL;
    6.70 +    memset(di, 0, sizeof(*di));
    6.71      di->mi = mi;
    6.72      di->xd_device = disk->device;
    6.73  
    6.74 -    if ((VDISK_TYPE(disk->info) == VDISK_TYPE_DISK) &&
    6.75 +    if (((disk->info & (VDISK_CDROM|VDISK_REMOVABLE)) == 0) &&
    6.76          ((minor & ((1 << mi->type->partn_shift) - 1)) == 0))
    6.77          nr_minors = 1 << mi->type->partn_shift;
    6.78  
    6.79      gd = alloc_disk(nr_minors);
    6.80 -    if ( !gd )
    6.81 +    if (gd == NULL)
    6.82          goto out;
    6.83  
    6.84 -    if ((VDISK_TYPE(disk->info) != VDISK_TYPE_DISK) || (nr_minors > 1))
    6.85 +    if (((disk->info & (VDISK_CDROM|VDISK_REMOVABLE)) != 0) || (nr_minors > 1))
    6.86          sprintf(gd->disk_name, "%s%c", mi->type->diskname,
    6.87                  'a' + mi->index * mi->type->disks_per_major +
    6.88                      (minor >> mi->type->partn_shift));
    6.89 @@ -302,21 +299,26 @@ struct gendisk *xlvbd_alloc_gendisk(
    6.90      gd->private_data = di;
    6.91      set_capacity(gd, disk->capacity);
    6.92  
    6.93 -    if ((xlbd_blk_queue == NULL) && xlvbd_blk_queue_alloc(mi->type))
    6.94 -            goto out_gendisk;
    6.95 +    if (xlvbd_init_blk_queue(gd, disk)) {
    6.96 +        del_gendisk(gd);
    6.97 +        goto out;
    6.98 +    }
    6.99  
   6.100 -    if (VDISK_READONLY(disk->info))
   6.101 +    di->rq = gd->queue;
   6.102 +
   6.103 +    if (disk->info & VDISK_READONLY)
   6.104          set_disk_ro(gd, 1);
   6.105  
   6.106 -    if (VDISK_TYPE(disk->info) == VDISK_TYPE_CDROM)
   6.107 -        gd->flags |= GENHD_FL_REMOVABLE | GENHD_FL_CD;
   6.108 +    if (disk->info & VDISK_REMOVABLE)
   6.109 +        gd->flags |= GENHD_FL_REMOVABLE;
   6.110  
   6.111 -    gd->queue = xlbd_blk_queue;
   6.112 +    if (disk->info & VDISK_CDROM)
   6.113 +        gd->flags |= GENHD_FL_CD;
   6.114 +
   6.115      add_disk(gd);
   6.116 +
   6.117      return gd;
   6.118  
   6.119 -out_gendisk:
   6.120 -    del_gendisk(gd);
   6.121  out:
   6.122      kfree(di);
   6.123      return NULL;
   6.124 @@ -367,6 +369,7 @@ static int xlvbd_device_del(struct lvdis
   6.125      struct gendisk *gd;
   6.126      struct xlbd_disk_info *di;
   6.127      int ret = 0, unused;
   6.128 +    request_queue_t *rq;
   6.129  
   6.130      device = MKDEV(MAJOR_XEN(disk->device), MINOR_XEN(disk->device));
   6.131  
   6.132 @@ -383,7 +386,10 @@ static int xlvbd_device_del(struct lvdis
   6.133          goto out;
   6.134      }
   6.135  
   6.136 +    rq = gd->queue;
   6.137      del_gendisk(gd);
   6.138 +    put_disk(gd);
   6.139 +    blk_cleanup_queue(rq);
   6.140  
   6.141      xlvbd_device_free(disk);
   6.142  out:
     7.1 --- a/netbsd-2.0-xen-sparse/sys/arch/xen/xen/xbd.c	Fri May 20 19:26:10 2005 +0000
     7.2 +++ b/netbsd-2.0-xen-sparse/sys/arch/xen/xen/xbd.c	Fri May 20 19:34:47 2005 +0000
     7.3 @@ -476,17 +476,11 @@ get_xbda(vdisk_t *xd)
     7.4  	case XEN_IDE7_MAJOR:
     7.5  	case XEN_IDE8_MAJOR:
     7.6  	case XEN_IDE9_MAJOR:
     7.7 -		switch (VDISK_TYPE(xd->info)) {
     7.8 -		case VDISK_TYPE_CDROM:
     7.9 +		if (xd->info & VDISK_CDROM)
    7.10  			return &cd_ata;
    7.11 -		case VDISK_TYPE_DISK:
    7.12 -			if (xd->capacity == 0)
    7.13 -				return NULL;
    7.14 -			return &wd_ata;
    7.15 -		default:
    7.16 +		if (xd->capacity == 0)
    7.17  			return NULL;
    7.18 -		}
    7.19 -		break;
    7.20 +		return &wd_ata;
    7.21  #endif
    7.22  	default:
    7.23  		if (xd->capacity == 0)
     8.1 --- a/tools/blktap/parallax-threaded.c	Fri May 20 19:26:10 2005 +0000
     8.2 +++ b/tools/blktap/parallax-threaded.c	Fri May 20 19:34:47 2005 +0000
     8.3 @@ -250,7 +250,7 @@ int parallax_probe(blkif_request_t *req,
     8.4          while (vdi) {
     8.5              img_info = (vdisk_t *)MMAP_VADDR(ID_TO_IDX(req->id), 0);
     8.6              img_info[nr_vdis].device   = vdi->vdevice;
     8.7 -            img_info[nr_vdis].info     = VDISK_TYPE_DISK | VDISK_FLAG_VIRT;
     8.8 +            img_info[nr_vdis].info     = 0;
     8.9              /* The -2 here accounts for the LSB in the radix tree */
    8.10              img_info[nr_vdis].capacity = 
    8.11                      ((1LL << (VDI_HEIGHT-2)) >> SECTOR_SHIFT);
     9.1 --- a/tools/blktap/parallax.c	Fri May 20 19:26:10 2005 +0000
     9.2 +++ b/tools/blktap/parallax.c	Fri May 20 19:34:47 2005 +0000
     9.3 @@ -252,7 +252,7 @@ int parallax_probe(blkif_request_t *req,
     9.4          while (vdi) {
     9.5              img_info = (vdisk_t *)MMAP_VADDR(ID_TO_IDX(req->id), 0);
     9.6              img_info[nr_vdis].device   = vdi->vdevice;
     9.7 -            img_info[nr_vdis].info     = VDISK_TYPE_DISK | VDISK_FLAG_VIRT;
     9.8 +            img_info[nr_vdis].info     = 0;
     9.9              /* The -1 here accounts for the LSB in the radix tree */
    9.10              img_info[nr_vdis].capacity = 
    9.11                      ((1LL << (VDI_HEIGHT-1)) * SECTS_PER_NODE);
    10.1 --- a/xen/include/public/io/blkif.h	Fri May 20 19:26:10 2005 +0000
    10.2 +++ b/xen/include/public/io/blkif.h	Fri May 20 19:34:47 2005 +0000
    10.3 @@ -83,26 +83,16 @@ DEFINE_RING_TYPES(blkif, blkif_request_t
    10.4   * of vdisk_t elements.
    10.5   */
    10.6  
    10.7 -/* XXX SMH: Type values below are chosen to match ide_xxx in Linux ide.h. */
    10.8 -#define VDISK_TYPE_FLOPPY  0x00
    10.9 -#define VDISK_TYPE_TAPE    0x01
   10.10 -#define VDISK_TYPE_CDROM   0x05
   10.11 -#define VDISK_TYPE_OPTICAL 0x07
   10.12 -#define VDISK_TYPE_DISK    0x20 
   10.13 +#define VDISK_CDROM        0x1
   10.14 +#define VDISK_REMOVABLE    0x2
   10.15 +#define VDISK_READONLY     0x4
   10.16  
   10.17 -#define VDISK_TYPE_MASK    0x3F
   10.18 -#define VDISK_TYPE(_x)     ((_x) & VDISK_TYPE_MASK) 
   10.19 -
   10.20 -/* The top two bits of the type field encode various flags. */
   10.21 -#define VDISK_FLAG_RO      0x40
   10.22 -#define VDISK_FLAG_VIRT    0x80
   10.23 -#define VDISK_READONLY(_x) ((_x) & VDISK_FLAG_RO)
   10.24 -#define VDISK_VIRTUAL(_x)  ((_x) & VDISK_FLAG_VIRT) 
   10.25 -
   10.26 -typedef struct {
   10.27 +typedef struct vdisk {
   10.28      blkif_sector_t capacity;     /*  0: Size in terms of 512-byte sectors.   */
   10.29      blkif_vdev_t   device;       /*  8: Device number (opaque 16 bit value). */
   10.30      u16            info;         /* 10: Device type and flags (VDISK_*).     */
   10.31 -} PACKED vdisk_t; /* 12 bytes */
   10.32 +    u16            sector_size;  /* 12: Minimum alignment for requests.      */
   10.33 +    u16            _pad;
   10.34 +} PACKED vdisk_t; /* 16 bytes */
   10.35  
   10.36  #endif /* __XEN_PUBLIC_IO_BLKIF_H__ */