ia64/xen-unstable

changeset 333:8c3e9c5563dd

bitkeeper revision 1.148.1.1 (3e79d51dkKmlnq2cVH-XRz9_lkZeXg)

Many files:
Allow up to 31 partitions per XL IDE or SCSI device. But can now only have 8 of each type of device.
author kaf24@scramble.cl.cam.ac.uk
date Thu Mar 20 14:50:05 2003 +0000 (2003-03-20)
parents 03dc7864109b
children 3f05356c923d
files xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.h xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_scsi.c xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_segment.c xenolinux-2.4.21-pre4-sparse/include/linux/major.h xenolinux-2.4.21-pre4-sparse/init/do_mounts.c
line diff
     1.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c	Wed Mar 19 19:05:13 2003 +0000
     1.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c	Thu Mar 20 14:50:05 2003 +0000
     1.3 @@ -15,8 +15,6 @@ typedef unsigned char byte; /* from linu
     1.4  #define XLBLK_RESPONSE_IRQ _EVENT_BLK_RESP
     1.5  #define DEBUG_IRQ          _EVENT_DEBUG 
     1.6  
     1.7 -#define PARTN_SHIFT 4
     1.8 -
     1.9  static blk_ring_t *blk_ring;
    1.10  static unsigned int resp_cons; /* Response consumer for comms ring. */
    1.11  static unsigned int req_prod;  /* Private request producer.         */
    1.12 @@ -54,22 +52,20 @@ static inline unsigned short xldev_to_ph
    1.13      switch ( MAJOR(xldev) ) 
    1.14      { 
    1.15      case XLIDE_MAJOR: 
    1.16 -        physdev = XENDEV_IDE;
    1.17 +        physdev = XENDEV_IDE + (MINOR(xldev) >> XLIDE_PARTN_SHIFT);
    1.18  	break; 
    1.19  	
    1.20      case XLSCSI_MAJOR: 
    1.21 -        physdev = XENDEV_SCSI;
    1.22 +        physdev = XENDEV_SCSI + (MINOR(xldev) >> XLSCSI_PARTN_SHIFT);
    1.23  	break; 
    1.24  
    1.25      case XLVIRT_MAJOR:
    1.26 -        physdev = XENDEV_VIRTUAL;
    1.27 +        physdev = XENDEV_VIRTUAL + (MINOR(xldev) >> XLVIRT_PARTN_SHIFT);
    1.28          break;
    1.29      } 
    1.30  
    1.31      if ( physdev == 0 ) BUG();
    1.32  
    1.33 -    physdev += (MINOR(xldev) >> PARTN_SHIFT);
    1.34 -
    1.35      return physdev;
    1.36  }
    1.37  
    1.38 @@ -102,7 +98,8 @@ static inline struct gendisk *xldev_to_g
    1.39  static inline xl_disk_t *xldev_to_xldisk(kdev_t xldev)
    1.40  {
    1.41      struct gendisk *gd = xldev_to_gendisk(xldev);
    1.42 -    return (xl_disk_t *)gd->real_devices + (MINOR(xldev) >> PARTN_SHIFT);
    1.43 +    return (xl_disk_t *)gd->real_devices + 
    1.44 +        (MINOR(xldev) >> PARTN_SHIFT(xldev));
    1.45  }
    1.46  
    1.47  
    1.48 @@ -233,7 +230,7 @@ int xenolinux_block_revalidate(kdev_t de
    1.49      struct gendisk *gd = xldev_to_gendisk(dev);
    1.50      xl_disk_t *disk = xldev_to_xldisk(dev);
    1.51      unsigned long flags;
    1.52 -    int i;
    1.53 +    int i, partn_shift = PARTN_SHIFT(dev);
    1.54      
    1.55      spin_lock_irqsave(&io_request_lock, flags);
    1.56      if ( disk->usage > 1 )
    1.57 @@ -243,15 +240,15 @@ int xenolinux_block_revalidate(kdev_t de
    1.58      }
    1.59      spin_unlock_irqrestore(&io_request_lock, flags);
    1.60  
    1.61 -    for ( i = 0; i < (1 << PARTN_SHIFT); i++ )
    1.62 +    for ( i = 0; i < (1 << partn_shift); i++ )
    1.63      {
    1.64          invalidate_device(dev + i, 1);
    1.65          gd->part[dev + i].start_sect = 0;
    1.66          gd->part[dev + i].nr_sects = 0;
    1.67      }
    1.68  
    1.69 -    grok_partitions(gd, MINOR(dev) >> PARTN_SHIFT,
    1.70 -                    1 << PARTN_SHIFT, disk->capacity);
    1.71 +    grok_partitions(gd, MINOR(dev) >> partn_shift,
    1.72 +                    1 << partn_shift, disk->capacity);
    1.73  
    1.74      return 0;
    1.75  }
     2.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.h	Wed Mar 19 19:05:13 2003 +0000
     2.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.h	Thu Mar 20 14:50:05 2003 +0000
     2.3 @@ -35,6 +35,12 @@
     2.4  #define DPRINTK_IOCTL(_f, _a...) ((void)0)
     2.5  #endif
     2.6  
     2.7 +/* IDE/SCSI have <= 32 partitions per device. VIRT has <= 16. */
     2.8 +#define PARTN_SHIFT(_dev) ((MAJOR(_dev)==XLVIRT_MAJOR) ? 4 : 5)
     2.9 +#define XLIDE_PARTN_SHIFT  5
    2.10 +#define XLSCSI_PARTN_SHIFT 5
    2.11 +#define XLVIRT_PARTN_SHIFT 4
    2.12 +
    2.13  /*
    2.14   * We have one of these per XL-IDE, XL-SCSI, and XL-VIRT device.
    2.15   * They hang in an array off the gendisk structure. We may end up putting
     3.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c	Wed Mar 19 19:05:13 2003 +0000
     3.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c	Thu Mar 20 14:50:05 2003 +0000
     3.3 @@ -13,7 +13,6 @@
     3.4  /* We support up to 16 devices of up to 16 partitions each. */
     3.5  #define XLIDE_MAX         256
     3.6  #define XLIDE_MAJOR_NAME "xhd"
     3.7 -#define IDE_PARTN_BITS    4
     3.8  static int xlide_blksize_size[XLIDE_MAX];
     3.9  static int xlide_hardsect_size[XLIDE_MAX];
    3.10  static int xlide_max_sectors[XLIDE_MAX];
    3.11 @@ -80,18 +79,17 @@ int xlide_init(xen_disk_info_t *xdi)
    3.12       */
    3.13      blk_queue_headactive(BLK_DEFAULT_QUEUE(XLIDE_MAJOR), 0);
    3.14  
    3.15 -    /* We may register up to 16 devices in a sparse identifier space. */
    3.16 -    units = 16;
    3.17 +    units = XLIDE_MAX >> XLIDE_PARTN_SHIFT;
    3.18  
    3.19      /* Construct an appropriate gendisk structure. */
    3.20 -    minors    = units * (1<<IDE_PARTN_BITS);
    3.21 +    minors    = units * (1<<XLIDE_PARTN_SHIFT);
    3.22      gd        = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
    3.23      gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL);
    3.24      gd->part  = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL);
    3.25      gd->major        = XLIDE_MAJOR;
    3.26      gd->major_name   = XLIDE_MAJOR_NAME;
    3.27 -    gd->minor_shift  = IDE_PARTN_BITS; 
    3.28 -    gd->max_p	     = 1<<IDE_PARTN_BITS;
    3.29 +    gd->minor_shift  = XLIDE_PARTN_SHIFT; 
    3.30 +    gd->max_p	     = 1<<XLIDE_PARTN_SHIFT;
    3.31      gd->nr_real	     = units;           
    3.32      gd->real_devices = kmalloc(units * sizeof(xl_disk_t), GFP_KERNEL);
    3.33      gd->next	     = NULL;            
    3.34 @@ -117,8 +115,8 @@ int xlide_init(xen_disk_info_t *xdi)
    3.35          ((xl_disk_t *)gd->real_devices)[disk].capacity =
    3.36              xdi->disks[i].capacity;
    3.37          register_disk(gd, 
    3.38 -                      MKDEV(XLIDE_MAJOR, disk<<IDE_PARTN_BITS), 
    3.39 -                      1<<IDE_PARTN_BITS, 
    3.40 +                      MKDEV(XLIDE_MAJOR, disk<<XLIDE_PARTN_SHIFT), 
    3.41 +                      1<<XLIDE_PARTN_SHIFT, 
    3.42                        &xlide_block_fops, 
    3.43                        xdi->disks[i].capacity);
    3.44      }
     4.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_scsi.c	Wed Mar 19 19:05:13 2003 +0000
     4.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_scsi.c	Thu Mar 20 14:50:05 2003 +0000
     4.3 @@ -13,7 +13,6 @@
     4.4  /* We support up to 16 devices of up to 16 partitions each. */
     4.5  #define XLSCSI_MAX        256
     4.6  #define XLSCSI_MAJOR_NAME "xsd"
     4.7 -#define SCSI_PARTN_BITS   4
     4.8  static int xlscsi_blksize_size[XLSCSI_MAX];
     4.9  static int xlscsi_hardsect_size[XLSCSI_MAX];
    4.10  static int xlscsi_max_sectors[XLSCSI_MAX];
    4.11 @@ -81,18 +80,17 @@ int xlscsi_init(xen_disk_info_t *xdi)
    4.12       */
    4.13      blk_queue_headactive(BLK_DEFAULT_QUEUE(XLSCSI_MAJOR), 0);
    4.14  
    4.15 -    /* We may register up to 16 devices in a sparse identifier space. */
    4.16 -    units = 16;
    4.17 +    units = XLSCSI_MAX >> XLSCSI_PARTN_SHIFT;
    4.18  
    4.19      /* Construct an appropriate gendisk structure. */
    4.20 -    minors    = units * (1<<SCSI_PARTN_BITS);
    4.21 +    minors    = units * (1<<XLSCSI_PARTN_SHIFT);
    4.22      gd        = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
    4.23      gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL);
    4.24      gd->part  = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL);
    4.25      gd->major        = XLSCSI_MAJOR;
    4.26      gd->major_name   = XLSCSI_MAJOR_NAME;
    4.27 -    gd->minor_shift  = SCSI_PARTN_BITS; 
    4.28 -    gd->max_p	     = 1<<SCSI_PARTN_BITS;
    4.29 +    gd->minor_shift  = XLSCSI_PARTN_SHIFT; 
    4.30 +    gd->max_p	     = 1<<XLSCSI_PARTN_SHIFT;
    4.31      gd->nr_real	     = units;           
    4.32      gd->real_devices = kmalloc(units * sizeof(xl_disk_t), GFP_KERNEL);
    4.33      gd->next	     = NULL;            
    4.34 @@ -118,8 +116,8 @@ int xlscsi_init(xen_disk_info_t *xdi)
    4.35          ((xl_disk_t *)gd->real_devices)[disk].capacity =
    4.36              xdi->disks[i].capacity;
    4.37          register_disk(gd,
    4.38 -                      MKDEV(XLSCSI_MAJOR, disk<<SCSI_PARTN_BITS), 
    4.39 -                      1<<SCSI_PARTN_BITS, 
    4.40 +                      MKDEV(XLSCSI_MAJOR, disk<<XLSCSI_PARTN_SHIFT), 
    4.41 +                      1<<XLSCSI_PARTN_SHIFT, 
    4.42                        &xlscsi_block_fops, 
    4.43                        xdi->disks[i].capacity);
    4.44      }
     5.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_segment.c	Wed Mar 19 19:05:13 2003 +0000
     5.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_segment.c	Thu Mar 20 14:50:05 2003 +0000
     5.3 @@ -16,7 +16,6 @@ typedef unsigned char byte;
     5.4  /* We support up to 16 devices of up to 16 partitions each. */
     5.5  #define XLVIRT_MAX        256
     5.6  #define XLVIRT_MAJOR_NAME "xvd"
     5.7 -#define VIRT_PARTN_BITS   4
     5.8  static int xlseg_blksize_size[XLVIRT_MAX];
     5.9  static int xlseg_hardsect_size[XLVIRT_MAX];
    5.10  static int xlseg_max_sectors[XLVIRT_MAX];
    5.11 @@ -90,22 +89,17 @@ int __init xlseg_init(void)
    5.12       */
    5.13      blk_queue_headactive(BLK_DEFAULT_QUEUE(XLVIRT_MAJOR), 0);
    5.14  
    5.15 -    /*
    5.16 -     * We may register up to 16 devices in a sparse identifier space.
    5.17 -     * Unlike with IDE and SCSI, we always register a gendisk, as new
    5.18 -     * virtual devices may get allocate dto us later on.
    5.19 -     */
    5.20 -    units = 16;
    5.21 +    units = XLVIRT_MAX >> XLVIRT_PARTN_SHIFT;
    5.22  
    5.23      /* Construct an appropriate gendisk structure. */
    5.24 -    minors    = units * (1<<VIRT_PARTN_BITS);
    5.25 +    minors    = units * (1<<XLVIRT_PARTN_SHIFT);
    5.26      gd        = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
    5.27      gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL);
    5.28      gd->part  = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL);
    5.29      gd->major        = XLVIRT_MAJOR;
    5.30      gd->major_name   = XLVIRT_MAJOR_NAME;
    5.31 -    gd->minor_shift  = VIRT_PARTN_BITS; 
    5.32 -    gd->max_p	     = 1<<VIRT_PARTN_BITS;
    5.33 +    gd->minor_shift  = XLVIRT_PARTN_SHIFT; 
    5.34 +    gd->max_p	     = 1<<XLVIRT_PARTN_SHIFT;
    5.35      gd->nr_real	     = units;           
    5.36      gd->real_devices = kmalloc(units * sizeof(xl_disk_t), GFP_KERNEL);
    5.37      gd->next	     = NULL;            
    5.38 @@ -132,8 +126,8 @@ int __init xlseg_init(void)
    5.39          ((xl_disk_t *)gd->real_devices)[disk].capacity =
    5.40              xdi->disks[i].capacity;
    5.41          register_disk(gd, 
    5.42 -                      MKDEV(XLVIRT_MAJOR, disk<<VIRT_PARTN_BITS), 
    5.43 -                      1<<VIRT_PARTN_BITS, 
    5.44 +                      MKDEV(XLVIRT_MAJOR, disk<<XLVIRT_PARTN_SHIFT), 
    5.45 +                      1<<XLVIRT_PARTN_SHIFT, 
    5.46                        &xlsegment_block_fops, 
    5.47                        xdi->disks[i].capacity);
    5.48      }
     6.1 --- a/xenolinux-2.4.21-pre4-sparse/include/linux/major.h	Wed Mar 19 19:05:13 2003 +0000
     6.2 +++ b/xenolinux-2.4.21-pre4-sparse/include/linux/major.h	Thu Mar 20 14:50:05 2003 +0000
     6.3 @@ -146,9 +146,10 @@
     6.4  #define	UMEM_MAJOR	116	/* http://www.umem.com/ Battery Backed RAM */
     6.5  
     6.6  /*
     6.7 - * Each of these majors supports up to 16 devices of <= 16 partitions each.
     6.8 - * eg. xhda == (123, 0), xhdb == (123, 16), ...
     6.9 - *     xsda == (124, 0), xsdb == (124, 16), ...
    6.10 + * XLIDE/XLSCSI each support up to 8 devices of <= 32 partitions each.
    6.11 + * XLVIRT supports 16 devices of <= 16 partitions each.
    6.12 + * eg. xhda == (123, 0), xhdb == (123, 32), ...
    6.13 + *     xsda == (124, 0), xsdb == (124, 32), ...
    6.14   *     xvda == (125, 0), xvdb == (125, 16), ...
    6.15   */
    6.16  #define XLIDE_MAJOR	123	/* XenoLinux IDE Device */
     7.1 --- a/xenolinux-2.4.21-pre4-sparse/init/do_mounts.c	Wed Mar 19 19:05:13 2003 +0000
     7.2 +++ b/xenolinux-2.4.21-pre4-sparse/init/do_mounts.c	Thu Mar 20 14:50:05 2003 +0000
     7.3 @@ -232,23 +232,15 @@ static struct dev_name_struct {
     7.4  	{ "ataraid/d15p",0x72F0 },
     7.5  #if defined(CONFIG_XENOLINUX_BLOCK)
     7.6          /* XenoLinux IDE Devices */
     7.7 -        { "xhda", 0x7B00 }, { "xhdb", 0x7B10 },
     7.8 -        { "xhdc", 0x7B20 }, { "xhdd", 0x7B30 },
     7.9 -        { "xhde", 0x7B40 }, { "xhdf", 0x7B50 },
    7.10 -        { "xhdg", 0x7B60 }, { "xhdh", 0x7B70 },
    7.11 -        { "xhdi", 0x7B80 }, { "xhdj", 0x7B90 },
    7.12 -        { "xhdk", 0x7BA0 }, { "xhdl", 0x7BB0 },
    7.13 -        { "xhdm", 0x7BC0 }, { "xhdn", 0x7BD0 },
    7.14 -        { "xhdo", 0x7BE0 }, { "xhdp", 0x7BF0 },
    7.15 +        { "xhda", 0x7B00 }, { "xhdb", 0x7B20 },
    7.16 +        { "xhdc", 0x7B40 }, { "xhdd", 0x7B60 },
    7.17 +        { "xhde", 0x7B80 }, { "xhdf", 0x7BA0 },
    7.18 +        { "xhdg", 0x7BC0 }, { "xhdh", 0x7BE0 },
    7.19          /* Xenolinux SCSI Devices */
    7.20 -        { "xsda", 0x7C00 }, { "xsdb", 0x7C10 },
    7.21 -        { "xsdc", 0x7C20 }, { "xsdd", 0x7C30 },
    7.22 -        { "xsde", 0x7C40 }, { "xsdf", 0x7C50 },
    7.23 -        { "xsdg", 0x7C60 }, { "xsdh", 0x7C70 },
    7.24 -        { "xsdi", 0x7C80 }, { "xsdj", 0x7C90 },
    7.25 -        { "xsdk", 0x7CA0 }, { "xsdl", 0x7CB0 },
    7.26 -        { "xsdm", 0x7CC0 }, { "xsdn", 0x7CD0 },
    7.27 -        { "xsdo", 0x7CE0 }, { "xsdp", 0x7CF0 },
    7.28 +        { "xsda", 0x7C00 }, { "xsdb", 0x7C20 },
    7.29 +        { "xsdc", 0x7C40 }, { "xsdd", 0x7C60 },
    7.30 +        { "xsde", 0x7C80 }, { "xsdf", 0x7CA0 },
    7.31 +        { "xsdg", 0x7CC0 }, { "xsdh", 0x7CE0 },
    7.32          /* XenoLinux Virtual Devices */
    7.33          { "xvda", 0x7D00 }, { "xvdb", 0x7D10 },
    7.34          { "xvdc", 0x7D20 }, { "xvdd", 0x7D30 },