Commit 143fe0af authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] Get rid of per-partition blk_size[]

kills use of blk_size[] for partitioned devices, removes ->sizes from
struct gendisk.
parent cfd17071
...@@ -194,7 +194,6 @@ struct mfm_info { ...@@ -194,7 +194,6 @@ struct mfm_info {
#define MFM_DRV_INFO mfm_info[raw_cmd.dev] #define MFM_DRV_INFO mfm_info[raw_cmd.dev]
static struct hd_struct mfm[MFM_MAXDRIVES << 6]; static struct hd_struct mfm[MFM_MAXDRIVES << 6];
static int mfm_sizes[MFM_MAXDRIVES << 6];
/* Stuff from the assembly routines */ /* Stuff from the assembly routines */
extern unsigned int hdc63463_baseaddress; /* Controller base address */ extern unsigned int hdc63463_baseaddress; /* Controller base address */
...@@ -1259,7 +1258,6 @@ static struct gendisk mfm_gendisk = { ...@@ -1259,7 +1258,6 @@ static struct gendisk mfm_gendisk = {
major_name: "mfm", major_name: "mfm",
minor_shift: 6, minor_shift: 6,
part: mfm, part: mfm,
sizes: mfm_sizes,
}; };
static struct block_device_operations mfm_fops = static struct block_device_operations mfm_fops =
......
...@@ -1961,7 +1961,6 @@ static boolean DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller) ...@@ -1961,7 +1961,6 @@ static boolean DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller)
Controller->MaxSectorsPerRequest[MinorNumber] = Controller->MaxSectorsPerRequest[MinorNumber] =
Controller->MaxBlocksPerCommand; Controller->MaxBlocksPerCommand;
Controller->GenericDiskInfo.part = Controller->DiskPartitions; Controller->GenericDiskInfo.part = Controller->DiskPartitions;
Controller->GenericDiskInfo.sizes = Controller->PartitionSizes;
/* /*
Complete initialization of the Generic Disk Information structure. Complete initialization of the Generic Disk Information structure.
*/ */
...@@ -2003,7 +2002,6 @@ static void DAC960_UnregisterBlockDevice(DAC960_Controller_T *Controller) ...@@ -2003,7 +2002,6 @@ static void DAC960_UnregisterBlockDevice(DAC960_Controller_T *Controller)
array, Max Sectors per Request array, and Max Segments per Request array. array, Max Sectors per Request array, and Max Segments per Request array.
*/ */
Controller->GenericDiskInfo.part = NULL; Controller->GenericDiskInfo.part = NULL;
Controller->GenericDiskInfo.sizes = NULL;
blk_clear(MajorNumber); blk_clear(MajorNumber);
/* /*
Remove the Generic Disk Information structure from the list. Remove the Generic Disk Information structure from the list.
...@@ -5295,7 +5293,7 @@ static int DAC960_Open(Inode_T *Inode, File_T *File) ...@@ -5295,7 +5293,7 @@ static int DAC960_Open(Inode_T *Inode, File_T *File)
DAC960_ComputeGenericDiskInfo(Controller); DAC960_ComputeGenericDiskInfo(Controller);
DAC960_RegisterDisk(Controller, LogicalDriveNumber); DAC960_RegisterDisk(Controller, LogicalDriveNumber);
} }
if (Controller->GenericDiskInfo.sizes[minor(Inode->i_rdev)] == 0) if (Controller->GenericDiskInfo.part[minor(Inode->i_rdev)].nr_sects == 0)
return -ENXIO; return -ENXIO;
/* /*
Increment Controller and Logical Drive Usage Counts. Increment Controller and Logical Drive Usage Counts.
......
...@@ -2473,7 +2473,6 @@ typedef struct DAC960_Controller ...@@ -2473,7 +2473,6 @@ typedef struct DAC960_Controller
} V2; } V2;
} FW; } FW;
DiskPartition_T DiskPartitions[DAC960_MinorCount]; DiskPartition_T DiskPartitions[DAC960_MinorCount];
int PartitionSizes[DAC960_MinorCount];
unsigned char ProgressBuffer[DAC960_ProgressBufferSize]; unsigned char ProgressBuffer[DAC960_ProgressBufferSize];
unsigned char UserStatusBuffer[DAC960_UserMessageSize]; unsigned char UserStatusBuffer[DAC960_UserMessageSize];
} }
......
...@@ -245,7 +245,6 @@ char *acsi_buffer; ...@@ -245,7 +245,6 @@ char *acsi_buffer;
unsigned long phys_acsi_buffer; unsigned long phys_acsi_buffer;
static int NDevices = 0; static int NDevices = 0;
static int acsi_sizes[MAX_DEV<<4] = { 0, };
static struct hd_struct acsi_part[MAX_DEV<<4] = { {0,0}, }; static struct hd_struct acsi_part[MAX_DEV<<4] = { {0,0}, };
static int access_count[MAX_DEV] = { 0, }; static int access_count[MAX_DEV] = { 0, };
...@@ -1359,7 +1358,6 @@ static struct gendisk acsi_gendisk = { ...@@ -1359,7 +1358,6 @@ static struct gendisk acsi_gendisk = {
major_name: "ad", major_name: "ad",
minor_shift: 4, minor_shift: 4,
part: acsi_part, part: acsi_part,
sizes: acsi_sizes,
fops: &acsi_fops, fops: &acsi_fops,
}; };
......
...@@ -109,8 +109,6 @@ int add_partition(struct block_device *bdev, struct blkpg_partition *p) ...@@ -109,8 +109,6 @@ int add_partition(struct block_device *bdev, struct blkpg_partition *p)
/* all seems OK */ /* all seems OK */
part[p->pno].start_sect = pstart; part[p->pno].start_sect = pstart;
part[p->pno].nr_sects = plength; part[p->pno].nr_sects = plength;
if (g->sizes)
g->sizes[minor(dev)+p->pno] = (plength >> (BLOCK_SIZE_BITS-9));
devfs_register_partitions (g, minor(dev), 0); devfs_register_partitions (g, minor(dev), 0);
return 0; return 0;
} }
...@@ -163,8 +161,6 @@ int del_partition(struct block_device *bdev, struct blkpg_partition *p) ...@@ -163,8 +161,6 @@ int del_partition(struct block_device *bdev, struct blkpg_partition *p)
part[p->pno].start_sect = 0; part[p->pno].start_sect = 0;
part[p->pno].nr_sects = 0; part[p->pno].nr_sects = 0;
if (g->sizes)
g->sizes[minor(dev) + p->pno] = 0;
devfs_register_partitions (g, minor(dev), 0); devfs_register_partitions (g, minor(dev), 0);
bd_release(bdevp); bd_release(bdevp);
bdput(bdevp); bdput(bdevp);
......
...@@ -348,8 +348,7 @@ static void cciss_geninit( int ctlr) ...@@ -348,8 +348,7 @@ static void cciss_geninit( int ctlr)
drv = &(hba[ctlr]->drv[i]); drv = &(hba[ctlr]->drv[i]);
if( !(drv->nr_blocks)) if( !(drv->nr_blocks))
continue; continue;
hba[ctlr]->hd[i << NWD_SHIFT].nr_sects = hba[ctlr]->hd[i << NWD_SHIFT].nr_sects = drv->nr_blocks;
hba[ctlr]->sizes[i << NWD_SHIFT] = drv->nr_blocks;
//hba[ctlr]->gendisk.nr_real++; //hba[ctlr]->gendisk.nr_real++;
(BLK_DEFAULT_QUEUE(MAJOR_NR + ctlr))->hardsect_size = drv->block_size; (BLK_DEFAULT_QUEUE(MAJOR_NR + ctlr))->hardsect_size = drv->block_size;
} }
...@@ -375,7 +374,7 @@ static int cciss_open(struct inode *inode, struct file *filep) ...@@ -375,7 +374,7 @@ static int cciss_open(struct inode *inode, struct file *filep)
* but I'm already using way to many device nodes to claim another one * but I'm already using way to many device nodes to claim another one
* for "raw controller". * for "raw controller".
*/ */
if (hba[ctlr]->sizes[minor(inode->i_rdev)] == 0) { if (inode->i_bdev->bd_inode->i_size == 0) {
if (minor(inode->i_rdev) != 0) if (minor(inode->i_rdev) != 0)
return -ENXIO; return -ENXIO;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
...@@ -806,7 +805,6 @@ static int revalidate_allvol(kdev_t dev) ...@@ -806,7 +805,6 @@ static int revalidate_allvol(kdev_t dev)
* on this controller to zero. We will reread all of this data * on this controller to zero. We will reread all of this data
*/ */
memset(hba[ctlr]->hd, 0, sizeof(struct hd_struct) * 256); memset(hba[ctlr]->hd, 0, sizeof(struct hd_struct) * 256);
memset(hba[ctlr]->sizes, 0, sizeof(int) * 256);
memset(hba[ctlr]->drv, 0, sizeof(drive_info_struct) memset(hba[ctlr]->drv, 0, sizeof(drive_info_struct)
* CISS_MAX_LUN); * CISS_MAX_LUN);
hba[ctlr]->gendisk.nr_real = 0; hba[ctlr]->gendisk.nr_real = 0;
...@@ -823,7 +821,7 @@ static int revalidate_allvol(kdev_t dev) ...@@ -823,7 +821,7 @@ static int revalidate_allvol(kdev_t dev)
cciss_geninit(ctlr); cciss_geninit(ctlr);
for(i=0; i<NWD; i++) { for(i=0; i<NWD; i++) {
kdev_t kdev = mk_kdev(major(dev), i << NWD_SHIFT); kdev_t kdev = mk_kdev(major(dev), i << NWD_SHIFT);
if (hba[ctlr]->sizes[ i<<NWD_SHIFT ]) if (hba[ctlr]->gendisk.part[ i<<NWD_SHIFT ].nr_sects)
revalidate_logvol(kdev, 2); revalidate_logvol(kdev, 2);
} }
...@@ -836,7 +834,7 @@ static int deregister_disk(int ctlr, int logvol) ...@@ -836,7 +834,7 @@ static int deregister_disk(int ctlr, int logvol)
unsigned long flags; unsigned long flags;
struct gendisk *gdev = &(hba[ctlr]->gendisk); struct gendisk *gdev = &(hba[ctlr]->gendisk);
ctlr_info_t *h = hba[ctlr]; ctlr_info_t *h = hba[ctlr];
int start, max_p, i; int start, max_p;
if (!capable(CAP_SYS_RAWIO)) if (!capable(CAP_SYS_RAWIO))
...@@ -856,8 +854,6 @@ static int deregister_disk(int ctlr, int logvol) ...@@ -856,8 +854,6 @@ static int deregister_disk(int ctlr, int logvol)
max_p = 1 << gdev->minor_shift; max_p = 1 << gdev->minor_shift;
start = logvol << gdev->minor_shift; start = logvol << gdev->minor_shift;
wipe_partitions(mk_kdev(MAJOR_NR+ctlr, start)); wipe_partitions(mk_kdev(MAJOR_NR+ctlr, start));
for (i=max_p-1; i>=0; i--)
h->sizes[start + i] = 0;
/* check to see if it was the last disk */ /* check to see if it was the last disk */
if (logvol == h->highest_lun) if (logvol == h->highest_lun)
{ {
...@@ -866,7 +862,7 @@ static int deregister_disk(int ctlr, int logvol) ...@@ -866,7 +862,7 @@ static int deregister_disk(int ctlr, int logvol)
for(i=0; i<h->highest_lun; i++) for(i=0; i<h->highest_lun; i++)
{ {
/* if the disk has size > 0, it is available */ /* if the disk has size > 0, it is available */
if (h->sizes[i << gdev->minor_shift] != 0) if (h->gendisk.part[i << gdev->minor_shift].nr_sects)
newhighest = i; newhighest = i;
} }
h->highest_lun = newhighest; h->highest_lun = newhighest;
...@@ -2498,7 +2494,6 @@ static int __init cciss_init_one(struct pci_dev *pdev, ...@@ -2498,7 +2494,6 @@ static int __init cciss_init_one(struct pci_dev *pdev,
hba[i]->gendisk.major_name = "cciss"; hba[i]->gendisk.major_name = "cciss";
hba[i]->gendisk.minor_shift = NWD_SHIFT; hba[i]->gendisk.minor_shift = NWD_SHIFT;
hba[i]->gendisk.part = hba[i]->hd; hba[i]->gendisk.part = hba[i]->hd;
hba[i]->gendisk.sizes = hba[i]->sizes;
hba[i]->gendisk.nr_real = hba[i]->highest_lun+1; hba[i]->gendisk.nr_real = hba[i]->highest_lun+1;
/* Get on the disk list */ /* Get on the disk list */
......
...@@ -104,7 +104,6 @@ static struct board_type products[] = { ...@@ -104,7 +104,6 @@ static struct board_type products[] = {
}; };
static struct hd_struct * ida; static struct hd_struct * ida;
static int * ida_sizes;
static struct gendisk ida_gendisk[MAX_CTLR]; static struct gendisk ida_gendisk[MAX_CTLR];
static struct proc_dir_entry *proc_array; static struct proc_dir_entry *proc_array;
...@@ -176,9 +175,7 @@ static void ida_geninit(int ctlr) ...@@ -176,9 +175,7 @@ static void ida_geninit(int ctlr)
drv = &hba[ctlr]->drv[i]; drv = &hba[ctlr]->drv[i];
if (!drv->nr_blks) if (!drv->nr_blks)
continue; continue;
ida[(ctlr<<CTLR_SHIFT) + (i<<NWD_SHIFT)].nr_sects = ida[(ctlr<<CTLR_SHIFT) + (i<<NWD_SHIFT)].nr_sects = drv->nr_blks;
ida_sizes[(ctlr<<CTLR_SHIFT) + (i<<NWD_SHIFT)] =
drv->nr_blks;
(BLK_DEFAULT_QUEUE(MAJOR_NR + ctlr))->hardsect_size = drv->blk_size; (BLK_DEFAULT_QUEUE(MAJOR_NR + ctlr))->hardsect_size = drv->blk_size;
ida_gendisk[ctlr].nr_real++; ida_gendisk[ctlr].nr_real++;
...@@ -339,7 +336,6 @@ void cleanup_module(void) ...@@ -339,7 +336,6 @@ void cleanup_module(void)
devfs_find_and_unregister(NULL, "ida", 0, 0, 0, 0); devfs_find_and_unregister(NULL, "ida", 0, 0, 0, 0);
remove_proc_entry("cpqarray", proc_root_driver); remove_proc_entry("cpqarray", proc_root_driver);
kfree(ida); kfree(ida);
kfree(ida_sizes);
} }
#endif /* MODULE */ #endif /* MODULE */
...@@ -372,16 +368,7 @@ int __init cpqarray_init(void) ...@@ -372,16 +368,7 @@ int __init cpqarray_init(void)
return(num_cntlrs_reg); return(num_cntlrs_reg);
} }
ida_sizes = kmalloc(sizeof(int)*nr_ctlr*NWD*16, GFP_KERNEL);
if(ida_sizes==NULL)
{
kfree(ida);
printk( KERN_ERR "cpqarray: out of memory");
return(num_cntlrs_reg);
}
memset(ida, 0, sizeof(struct hd_struct)*nr_ctlr*NWD*16); memset(ida, 0, sizeof(struct hd_struct)*nr_ctlr*NWD*16);
memset(ida_sizes, 0, sizeof(int)*nr_ctlr*NWD*16);
memset(ida_gendisk, 0, sizeof(struct gendisk)*MAX_CTLR); memset(ida_gendisk, 0, sizeof(struct gendisk)*MAX_CTLR);
/* /*
...@@ -437,7 +424,6 @@ int __init cpqarray_init(void) ...@@ -437,7 +424,6 @@ int __init cpqarray_init(void)
if (num_cntlrs_reg == 0) if (num_cntlrs_reg == 0)
{ {
kfree(ida); kfree(ida);
kfree(ida_sizes);
} }
return(num_cntlrs_reg); return(num_cntlrs_reg);
...@@ -469,7 +455,6 @@ int __init cpqarray_init(void) ...@@ -469,7 +455,6 @@ int __init cpqarray_init(void)
ida_gendisk[i].major_name = "ida"; ida_gendisk[i].major_name = "ida";
ida_gendisk[i].minor_shift = NWD_SHIFT; ida_gendisk[i].minor_shift = NWD_SHIFT;
ida_gendisk[i].part = ida + (i*256); ida_gendisk[i].part = ida + (i*256);
ida_gendisk[i].sizes = ida_sizes + (i*256);
ida_gendisk[i].nr_real = 0; ida_gendisk[i].nr_real = 0;
ida_gendisk[i].de_arr = de_arr[i]; ida_gendisk[i].de_arr = de_arr[i];
ida_gendisk[i].fops = &ida_fops; ida_gendisk[i].fops = &ida_fops;
...@@ -770,8 +755,7 @@ static int ida_open(struct inode *inode, struct file *filep) ...@@ -770,8 +755,7 @@ static int ida_open(struct inode *inode, struct file *filep)
if (ctlr > MAX_CTLR || hba[ctlr] == NULL) if (ctlr > MAX_CTLR || hba[ctlr] == NULL)
return -ENXIO; return -ENXIO;
if (!capable(CAP_SYS_RAWIO) && ida_sizes[(ctlr << CTLR_SHIFT) + if (!capable(CAP_SYS_RAWIO) && inode->i_bdev->bd_inode->i_size == 0)
minor(inode->i_rdev)] == 0)
return -ENXIO; return -ENXIO;
/* /*
...@@ -781,7 +765,7 @@ static int ida_open(struct inode *inode, struct file *filep) ...@@ -781,7 +765,7 @@ static int ida_open(struct inode *inode, struct file *filep)
* for "raw controller". * for "raw controller".
*/ */
if (capable(CAP_SYS_ADMIN) if (capable(CAP_SYS_ADMIN)
&& ida_sizes[(ctlr << CTLR_SHIFT) + minor(inode->i_rdev)] == 0 && inode->i_bdev->bd_inode->i_size == 0
&& minor(inode->i_rdev) != 0) && minor(inode->i_rdev) != 0)
return -ENXIO; return -ENXIO;
...@@ -1498,7 +1482,6 @@ static int revalidate_allvol(kdev_t dev) ...@@ -1498,7 +1482,6 @@ static int revalidate_allvol(kdev_t dev)
* on this controller to zero. We will reread all of this data * on this controller to zero. We will reread all of this data
*/ */
memset(ida+(ctlr*256), 0, sizeof(struct hd_struct)*NWD*16); memset(ida+(ctlr*256), 0, sizeof(struct hd_struct)*NWD*16);
memset(ida_sizes+(ctlr*256), 0, sizeof(int)*NWD*16);
memset(hba[ctlr]->drv, 0, sizeof(drv_info_t)*NWD); memset(hba[ctlr]->drv, 0, sizeof(drv_info_t)*NWD);
ida_gendisk[ctlr].nr_real = 0; ida_gendisk[ctlr].nr_real = 0;
...@@ -1514,7 +1497,7 @@ static int revalidate_allvol(kdev_t dev) ...@@ -1514,7 +1497,7 @@ static int revalidate_allvol(kdev_t dev)
ida_geninit(ctlr); ida_geninit(ctlr);
for(i=0; i<NWD; i++) { for(i=0; i<NWD; i++) {
kdev_t kdev = mk_kdev(major(dev), i << NWD_SHIFT); kdev_t kdev = mk_kdev(major(dev), i << NWD_SHIFT);
if (ida_sizes[(ctlr<<CTLR_SHIFT) + (i<<NWD_SHIFT)]) if (ida[(ctlr<<CTLR_SHIFT) + (i<<NWD_SHIFT)].nr_sects)
revalidate_logvol(kdev, 2); revalidate_logvol(kdev, 2);
} }
......
...@@ -157,8 +157,8 @@ static int show_partition(struct seq_file *part, void *v) ...@@ -157,8 +157,8 @@ static int show_partition(struct seq_file *part, void *v)
int minormask = (1<<sgp->minor_shift) - 1; int minormask = (1<<sgp->minor_shift) - 1;
if ((n & minormask) && sgp->part[n].nr_sects == 0) if ((n & minormask) && sgp->part[n].nr_sects == 0)
continue; continue;
seq_printf(part, "%4d %4d %10d %s\n", seq_printf(part, "%4d %4d %10ld %s\n",
sgp->major, n, sgp->sizes[n], sgp->major, n, sgp->part[n].nr_sects << 1,
disk_name(sgp, n, buf)); disk_name(sgp, n, buf));
} }
......
...@@ -272,7 +272,6 @@ static int pd_check_media(kdev_t dev); ...@@ -272,7 +272,6 @@ static int pd_check_media(kdev_t dev);
static void pd_eject( int unit); static void pd_eject( int unit);
static struct hd_struct pd_hd[PD_DEVS]; static struct hd_struct pd_hd[PD_DEVS];
static int pd_sizes[PD_DEVS];
#define PD_NAMELEN 8 #define PD_NAMELEN 8
...@@ -332,7 +331,6 @@ static struct gendisk pd_gendisk = { ...@@ -332,7 +331,6 @@ static struct gendisk pd_gendisk = {
major_name: PD_NAME, major_name: PD_NAME,
minor_shift: PD_BITS, minor_shift: PD_BITS,
part: pd_hd, part: pd_hd,
sizes: pd_sizes,
fops: &pd_fops, fops: &pd_fops,
}; };
......
...@@ -110,7 +110,6 @@ static u_int dma_arb_level; /* DMA arbitration level */ ...@@ -110,7 +110,6 @@ static u_int dma_arb_level; /* DMA arbitration level */
static DECLARE_WAIT_QUEUE_HEAD(ps2esdi_int); static DECLARE_WAIT_QUEUE_HEAD(ps2esdi_int);
static int no_int_yet; static int no_int_yet;
static int ps2esdi_sizes[MAX_HD << 6];
static int ps2esdi_drives; static int ps2esdi_drives;
static struct hd_struct ps2esdi[MAX_HD << 6]; static struct hd_struct ps2esdi[MAX_HD << 6];
static u_short io_base; static u_short io_base;
...@@ -155,7 +154,6 @@ static struct gendisk ps2esdi_gendisk = ...@@ -155,7 +154,6 @@ static struct gendisk ps2esdi_gendisk =
major_name: "ed", major_name: "ed",
minor_shift: 6, minor_shift: 6,
part: ps2esdi, part: ps2esdi,
sizes: ps2esdi_sizes,
fops: &ps2esdi_fops, fops: &ps2esdi_fops,
}; };
......
...@@ -160,7 +160,6 @@ static struct block_device_operations mm_fops; ...@@ -160,7 +160,6 @@ static struct block_device_operations mm_fops;
static struct timer_list battery_timer; static struct timer_list battery_timer;
static int mm_sizes[MM_MAXCARDS << MM_SHIFT];
static struct hd_struct mm_partitions[MM_MAXCARDS << MM_SHIFT]; static struct hd_struct mm_partitions[MM_MAXCARDS << MM_SHIFT];
static int num_cards = 0; static int num_cards = 0;
...@@ -1206,7 +1205,6 @@ int __init mm_init(void) ...@@ -1206,7 +1205,6 @@ int __init mm_init(void)
printk(KERN_INFO DRIVER_VERSION " : " DRIVER_DESC "\n"); printk(KERN_INFO DRIVER_VERSION " : " DRIVER_DESC "\n");
memset (cards, 0, MM_MAXCARDS * sizeof(struct cardinfo)); memset (cards, 0, MM_MAXCARDS * sizeof(struct cardinfo));
memset (mm_sizes, 0, (MM_MAXCARDS << MM_SHIFT) * sizeof (int));
memset (mm_partitions, 0, memset (mm_partitions, 0,
(MM_MAXCARDS << MM_SHIFT) * sizeof(struct hd_struct)); (MM_MAXCARDS << MM_SHIFT) * sizeof(struct hd_struct));
...@@ -1223,11 +1221,6 @@ int __init mm_init(void) ...@@ -1223,11 +1221,6 @@ int __init mm_init(void)
/* Initialize partition size: partion 0 of each card is the entire card */ /* Initialize partition size: partion 0 of each card is the entire card */
for (i = 0; i < num_cards; i++) {
mm_sizes[i << MM_SHIFT] = cards[i].mm_size;
}
mm_gendisk.sizes = mm_sizes;
for (i = 0; i < num_cards; i++) { for (i = 0; i < num_cards; i++) {
spin_lock_init(&cards[i].lock); spin_lock_init(&cards[i].lock);
mm_partitions[i << MM_SHIFT].nr_sects = mm_partitions[i << MM_SHIFT].nr_sects =
...@@ -1271,8 +1264,6 @@ void __exit mm_cleanup(void) ...@@ -1271,8 +1264,6 @@ void __exit mm_cleanup(void)
unregister_blkdev(MAJOR_NR, "umem"); unregister_blkdev(MAJOR_NR, "umem");
blk_size [MAJOR_NR] = NULL;
/* /*
* Get our gendisk structure off the list. * Get our gendisk structure off the list.
*/ */
......
...@@ -122,7 +122,6 @@ static unsigned int xd_bases[] __initdata = ...@@ -122,7 +122,6 @@ static unsigned int xd_bases[] __initdata =
}; };
static struct hd_struct xd_struct[XD_MAXDRIVES << 6]; static struct hd_struct xd_struct[XD_MAXDRIVES << 6];
static int xd_sizes[XD_MAXDRIVES << 6];
static spinlock_t xd_lock = SPIN_LOCK_UNLOCKED; static spinlock_t xd_lock = SPIN_LOCK_UNLOCKED;
...@@ -133,7 +132,6 @@ static struct gendisk xd_gendisk = { ...@@ -133,7 +132,6 @@ static struct gendisk xd_gendisk = {
major_name: "xd", major_name: "xd",
minor_shift: 6, minor_shift: 6,
part: xd_struct, part: xd_struct,
sizes: xd_sizes,
fops: &xd_fops, fops: &xd_fops,
}; };
......
...@@ -45,7 +45,6 @@ static void ataraid_split_request(request_queue_t * q, int rw, ...@@ -45,7 +45,6 @@ static void ataraid_split_request(request_queue_t * q, int rw,
struct gendisk ataraid_gendisk; struct gendisk ataraid_gendisk;
static int ataraid_gendisk_sizes[256];
static int ataraid_readahead[256]; static int ataraid_readahead[256];
static struct block_device_operations ataraid_fops = { static struct block_device_operations ataraid_fops = {
...@@ -257,7 +256,6 @@ static __init int ataraid_init(void) ...@@ -257,7 +256,6 @@ static __init int ataraid_init(void)
ataraid_gendisk.major = ATAMAJOR; ataraid_gendisk.major = ATAMAJOR;
ataraid_gendisk.major_name = "ataraid"; ataraid_gendisk.major_name = "ataraid";
ataraid_gendisk.minor_shift = 4; ataraid_gendisk.minor_shift = 4;
ataraid_gendisk.sizes = &ataraid_gendisk_sizes[0];
ataraid_gendisk.nr_real = 16; ataraid_gendisk.nr_real = 16;
ataraid_gendisk.fops = &ataraid_fops; ataraid_gendisk.fops = &ataraid_fops;
...@@ -282,7 +280,6 @@ static __init int ataraid_init(void) ...@@ -282,7 +280,6 @@ static __init int ataraid_init(void)
static void __exit ataraid_exit(void) static void __exit ataraid_exit(void)
{ {
unregister_blkdev(ATAMAJOR, "ataraid"); unregister_blkdev(ATAMAJOR, "ataraid");
blk_size[ATAMAJOR] = NULL;
del_gendisk(&ataraid_gendisk); del_gendisk(&ataraid_gendisk);
......
...@@ -148,7 +148,6 @@ static int NR_HD; ...@@ -148,7 +148,6 @@ static int NR_HD;
#endif #endif
static struct hd_struct hd[MAX_HD<<6]; static struct hd_struct hd[MAX_HD<<6];
static int hd_sizes[MAX_HD<<6];
static struct timer_list device_timer; static struct timer_list device_timer;
...@@ -714,7 +713,6 @@ static struct gendisk hd_gendisk = { ...@@ -714,7 +713,6 @@ static struct gendisk hd_gendisk = {
.major_name = "hd", .major_name = "hd",
.minor_shift = 6, .minor_shift = 6,
.part = hd, .part = hd,
.sizes = hd_sizes,
.fops = &hd_fops, .fops = &hd_fops,
}; };
......
...@@ -2012,7 +2012,6 @@ static int cdrom_read_toc(struct ata_device *drive, struct request_sense *sense) ...@@ -2012,7 +2012,6 @@ static int cdrom_read_toc(struct ata_device *drive, struct request_sense *sense)
if (stat) if (stat)
toc->capacity = 0x1fffff; toc->capacity = 0x1fffff;
drive->channel->gd->sizes[drive->select.b.unit << PARTN_BITS] = (toc->capacity * SECTORS_PER_FRAME) >> (BLOCK_SIZE_BITS - 9);
drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME; drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME;
/* Remember that we've read this stuff. */ /* Remember that we've read this stuff. */
...@@ -2878,7 +2877,6 @@ void ide_cdrom_revalidate(struct ata_device *drive) ...@@ -2878,7 +2877,6 @@ void ide_cdrom_revalidate(struct ata_device *drive)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
struct atapi_toc *toc; struct atapi_toc *toc;
int minor = drive->select.b.unit << PARTN_BITS;
struct request_sense sense; struct request_sense sense;
cdrom_read_toc(drive, &sense); cdrom_read_toc(drive, &sense);
...@@ -2890,8 +2888,6 @@ void ide_cdrom_revalidate(struct ata_device *drive) ...@@ -2890,8 +2888,6 @@ void ide_cdrom_revalidate(struct ata_device *drive)
/* for general /dev/cdrom like mounting, one big disc */ /* for general /dev/cdrom like mounting, one big disc */
drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME; drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME;
drive->channel->gd->sizes[minor] = toc->capacity * BLOCKS_PER_FRAME;
blk_size[drive->channel->major] = drive->channel->gd->sizes;
} }
static sector_t ide_cdrom_capacity(struct ata_device *drive) static sector_t ide_cdrom_capacity(struct ata_device *drive)
......
...@@ -491,7 +491,6 @@ void ide_unregister(struct ata_channel *ch) ...@@ -491,7 +491,6 @@ void ide_unregister(struct ata_channel *ch)
gd = ch->gd; gd = ch->gd;
if (gd) { if (gd) {
del_gendisk(gd); del_gendisk(gd);
kfree(gd->sizes);
kfree(gd->part); kfree(gd->part);
if (gd->de_arr) if (gd->de_arr)
kfree (gd->de_arr); kfree (gd->de_arr);
......
...@@ -1108,10 +1108,6 @@ static void channel_init(struct ata_channel *ch) ...@@ -1108,10 +1108,6 @@ static void channel_init(struct ata_channel *ch)
goto err_kmalloc_gd; goto err_kmalloc_gd;
memset(gd, 0, sizeof(struct gendisk)); memset(gd, 0, sizeof(struct gendisk));
gd->sizes = kmalloc(ATA_MINORS * sizeof(int), GFP_KERNEL);
if (!gd->sizes)
goto err_kmalloc_gd_sizes;
memset(gd->sizes, 0, ATA_MINORS*sizeof(gd->sizes[0]));
gd->part = kmalloc(ATA_MINORS * sizeof(struct hd_struct), GFP_KERNEL); gd->part = kmalloc(ATA_MINORS * sizeof(struct hd_struct), GFP_KERNEL);
if (!gd->part) if (!gd->part)
...@@ -1164,8 +1160,6 @@ static void channel_init(struct ata_channel *ch) ...@@ -1164,8 +1160,6 @@ static void channel_init(struct ata_channel *ch)
err_kmalloc_gd_de_arr: err_kmalloc_gd_de_arr:
kfree(gd->part); kfree(gd->part);
err_kmalloc_gd_part: err_kmalloc_gd_part:
kfree(gd->sizes);
err_kmalloc_gd_sizes:
kfree(gd); kfree(gd);
err_kmalloc_gd: err_kmalloc_gd:
printk(KERN_CRIT "(%s) Out of memory\n", __FUNCTION__); printk(KERN_CRIT "(%s) Out of memory\n", __FUNCTION__);
......
...@@ -122,7 +122,6 @@ static struct gendisk md_gendisk= ...@@ -122,7 +122,6 @@ static struct gendisk md_gendisk=
.major_name = "md", .major_name = "md",
.minor_shift = 0, .minor_shift = 0,
.part = md_hd_struct, .part = md_hd_struct,
.sizes = md_size,
.nr_real = MAX_MD_DEVS, .nr_real = MAX_MD_DEVS,
.next = NULL, .next = NULL,
.fops = &md_fops, .fops = &md_fops,
...@@ -3177,7 +3176,6 @@ static void md_geninit(void) ...@@ -3177,7 +3176,6 @@ static void md_geninit(void)
for(i = 0; i < MAX_MD_DEVS; i++) { for(i = 0; i < MAX_MD_DEVS; i++) {
md_size[i] = 0; md_size[i] = 0;
} }
blk_size[MAJOR_NR] = md_size;
dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t)); dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t));
......
...@@ -124,7 +124,6 @@ ...@@ -124,7 +124,6 @@
* Some of these can be made smaller later * Some of these can be made smaller later
*/ */
static int i2ob_sizes[MAX_I2OB<<4];
static int i2ob_media_change_flag[MAX_I2OB]; static int i2ob_media_change_flag[MAX_I2OB];
static int i2ob_context; static int i2ob_context;
...@@ -731,7 +730,6 @@ static int i2ob_evt(void *dummy) ...@@ -731,7 +730,6 @@ static int i2ob_evt(void *dummy)
{ {
for(i = unit; i <= unit+15; i++) for(i = unit; i <= unit+15; i++)
{ {
i2ob_sizes[i] = 0;
blk_queue_max_sectors(i2ob_dev[i].req_queue, 0); blk_queue_max_sectors(i2ob_dev[i].req_queue, 0);
i2ob[i].nr_sects = 0; i2ob[i].nr_sects = 0;
i2ob_gendisk.part[i].nr_sects = 0; i2ob_gendisk.part[i].nr_sects = 0;
...@@ -767,7 +765,6 @@ static int i2ob_evt(void *dummy) ...@@ -767,7 +765,6 @@ static int i2ob_evt(void *dummy)
i2ob_query_device(&i2ob_dev[unit], 0x0000, 4, &size, 8); i2ob_query_device(&i2ob_dev[unit], 0x0000, 4, &size, 8);
spin_lock_irqsave(&I2O_LOCK(unit), flags); spin_lock_irqsave(&I2O_LOCK(unit), flags);
i2ob_sizes[unit] = (int)(size>>10);
i2ob_gendisk.part[unit].nr_sects = size>>9; i2ob_gendisk.part[unit].nr_sects = size>>9;
i2ob[unit].nr_sects = (int)(size>>9); i2ob[unit].nr_sects = (int)(size>>9);
spin_unlock_irqrestore(&I2O_LOCK(unit), flags); spin_unlock_irqrestore(&I2O_LOCK(unit), flags);
...@@ -1081,7 +1078,7 @@ static int i2ob_ioctl(struct inode *inode, struct file *file, ...@@ -1081,7 +1078,7 @@ static int i2ob_ioctl(struct inode *inode, struct file *file,
{ {
struct hd_geometry g; struct hd_geometry g;
int u = minor(inode->i_rdev) & 0xF0; int u = minor(inode->i_rdev) & 0xF0;
i2o_block_biosparam(i2ob_sizes[u]<<1, i2o_block_biosparam(i2ob[u].nr_sects,
&g.cylinders, &g.heads, &g.sectors); &g.cylinders, &g.heads, &g.sectors);
g.start = get_start_sect(inode->i_bdev); g.start = get_start_sect(inode->i_bdev);
return copy_to_user((void *)arg, &g, sizeof(g)) return copy_to_user((void *)arg, &g, sizeof(g))
...@@ -1268,7 +1265,6 @@ static int i2ob_install_device(struct i2o_controller *c, struct i2o_device *d, i ...@@ -1268,7 +1265,6 @@ static int i2ob_install_device(struct i2o_controller *c, struct i2o_device *d, i
i2ob_query_device(dev, 0x0000, 5, &flags, 4); i2ob_query_device(dev, 0x0000, 5, &flags, 4);
i2ob_query_device(dev, 0x0000, 6, &status, 4); i2ob_query_device(dev, 0x0000, 6, &status, 4);
i2ob_sizes[unit] = (int)(size>>10);
i2ob_gendisk.part[unit].nr_sects = size>>9; i2ob_gendisk.part[unit].nr_sects = size>>9;
i2ob[unit].nr_sects = (int)(size>>9); i2ob[unit].nr_sects = (int)(size>>9);
...@@ -1655,7 +1651,6 @@ void i2ob_del_device(struct i2o_controller *c, struct i2o_device *d) ...@@ -1655,7 +1651,6 @@ void i2ob_del_device(struct i2o_controller *c, struct i2o_device *d)
for(i = unit; i <= unit+15; i++) for(i = unit; i <= unit+15; i++)
{ {
i2ob_dev[i].i2odev = NULL; i2ob_dev[i].i2odev = NULL;
i2ob_sizes[i] = 0;
blk_queue_max_sectors(i2ob_dev[i].req_queue, 0); blk_queue_max_sectors(i2ob_dev[i].req_queue, 0);
i2ob[i].nr_sects = 0; i2ob[i].nr_sects = 0;
i2ob_gendisk.part[i].nr_sects = 0; i2ob_gendisk.part[i].nr_sects = 0;
...@@ -1762,7 +1757,6 @@ static struct gendisk i2ob_gendisk = ...@@ -1762,7 +1757,6 @@ static struct gendisk i2ob_gendisk =
major_name: "i2o/hd", major_name: "i2o/hd",
minor_shift: 4, minor_shift: 4,
part: i2ob, part: i2ob,
sizes: i2ob_sizes,
nr_real: MAX_I2OB, nr_real: MAX_I2OB,
fops: &i2ob_fops, fops: &i2ob_fops,
}; };
......
...@@ -175,14 +175,12 @@ static struct mtd_notifier ftl_notifier = { ...@@ -175,14 +175,12 @@ static struct mtd_notifier ftl_notifier = {
#define XFER_FAILED 0x04 #define XFER_FAILED 0x04
static struct hd_struct ftl_hd[MINOR_NR(MAX_DEV, 0, 0)]; static struct hd_struct ftl_hd[MINOR_NR(MAX_DEV, 0, 0)];
static int ftl_sizes[MINOR_NR(MAX_DEV, 0, 0)];
static struct gendisk ftl_gendisk = { static struct gendisk ftl_gendisk = {
major: FTL_MAJOR, major: FTL_MAJOR,
major_name: "ftl", major_name: "ftl",
minor_shift: PART_BITS, minor_shift: PART_BITS,
part: ftl_hd, part: ftl_hd,
sizes: ftl_sizes,
}; };
/*====================================================================*/ /*====================================================================*/
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/blkpg.h> #include <linux/blkpg.h>
#include <linux/buffer_head.h>
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
#include <linux/kmod.h> #include <linux/kmod.h>
...@@ -52,17 +53,16 @@ ...@@ -52,17 +53,16 @@
* encountered, except ... * encountered, except ...
*/ */
static int nftl_sizes[256];
/* .. for the Linux partition table handling. */ /* .. for the Linux partition table handling. */
/* So why didn't you fucking go and clean it up? -- AV */
struct hd_struct part_table[256]; struct hd_struct part_table[256];
static struct block_device_operations nftl_fops;
static struct gendisk nftl_gendisk = { static struct gendisk nftl_gendisk = {
major: MAJOR_NR, major: MAJOR_NR,
major_name: "nftl", major_name: "nftl",
minor_shift: NFTL_PARTN_BITS, /* # of partition bits */ minor_shift: NFTL_PARTN_BITS, /* # of partition bits */
part: part_table, /* hd struct */ part: part_table, /* hd struct */
sizes: nftl_sizes, /* block sizes */
}; };
struct NFTLrecord *NFTLs[MAX_NFTLS]; struct NFTLrecord *NFTLs[MAX_NFTLS];
...@@ -143,7 +143,6 @@ static void NFTL_setup(struct mtd_info *mtd) ...@@ -143,7 +143,6 @@ static void NFTL_setup(struct mtd_info *mtd)
} }
NFTLs[firstfree] = nftl; NFTLs[firstfree] = nftl;
/* Finally, set up the block device sizes */ /* Finally, set up the block device sizes */
nftl_sizes[firstfree * 16] = nftl->nr_sects;
part_table[firstfree * 16].nr_sects = nftl->nr_sects; part_table[firstfree * 16].nr_sects = nftl->nr_sects;
nftl_gendisk.nr_real++; nftl_gendisk.nr_real++;
......
...@@ -66,7 +66,6 @@ dasd_register_major(int major) ...@@ -66,7 +66,6 @@ dasd_register_major(int major)
struct major_info *mi; struct major_info *mi;
struct hd_struct *gd_part; struct hd_struct *gd_part;
devfs_handle_t *gd_de_arr; devfs_handle_t *gd_de_arr;
int *gd_sizes;
char *gd_flags; char *gd_flags;
int new_major, rc; int new_major, rc;
...@@ -79,11 +78,10 @@ dasd_register_major(int major) ...@@ -79,11 +78,10 @@ dasd_register_major(int major)
GFP_KERNEL); GFP_KERNEL);
gd_flags = kmalloc(DASD_PER_MAJOR * sizeof(char), GFP_KERNEL); gd_flags = kmalloc(DASD_PER_MAJOR * sizeof(char), GFP_KERNEL);
gd_part = kmalloc(sizeof (struct hd_struct) << MINORBITS, GFP_ATOMIC); gd_part = kmalloc(sizeof (struct hd_struct) << MINORBITS, GFP_ATOMIC);
gd_sizes = kmalloc(sizeof(int) << MINORBITS, GFP_ATOMIC);
/* Check if one of the allocations failed. */ /* Check if one of the allocations failed. */
if (mi == NULL || gd_de_arr == NULL || gd_flags == NULL || if (mi == NULL || gd_de_arr == NULL || gd_flags == NULL ||
gd_part == NULL || gd_sizes == NULL) { gd_part == NULL) {
MESSAGE(KERN_WARNING, "%s", MESSAGE(KERN_WARNING, "%s",
"Cannot get memory to allocate another " "Cannot get memory to allocate another "
"major number"); "major number");
...@@ -112,17 +110,14 @@ dasd_register_major(int major) ...@@ -112,17 +110,14 @@ dasd_register_major(int major)
mi->gendisk.de_arr = gd_de_arr; mi->gendisk.de_arr = gd_de_arr;
mi->gendisk.flags = gd_flags; mi->gendisk.flags = gd_flags;
mi->gendisk.part = gd_part; mi->gendisk.part = gd_part;
mi->gendisk.sizes = gd_sizes;
/* Initialize the gendisk arrays. */ /* Initialize the gendisk arrays. */
memset(gd_de_arr, 0, DASD_PER_MAJOR * sizeof(devfs_handle_t)); memset(gd_de_arr, 0, DASD_PER_MAJOR * sizeof(devfs_handle_t));
memset(gd_flags, 0, DASD_PER_MAJOR * sizeof (char)); memset(gd_flags, 0, DASD_PER_MAJOR * sizeof (char));
memset(gd_part, 0, sizeof (struct hd_struct) << MINORBITS); memset(gd_part, 0, sizeof (struct hd_struct) << MINORBITS);
memset(gd_sizes, 0, sizeof(int) << MINORBITS);
/* Setup block device pointers for the new major. */ /* Setup block device pointers for the new major. */
blk_dev[new_major].queue = dasd_get_queue; blk_dev[new_major].queue = dasd_get_queue;
blk_size[new_major] = gd_sizes;
/* Insert the new major info structure into dasd_major_info list. */ /* Insert the new major info structure into dasd_major_info list. */
spin_lock(&dasd_major_lock); spin_lock(&dasd_major_lock);
...@@ -136,7 +131,6 @@ dasd_register_major(int major) ...@@ -136,7 +131,6 @@ dasd_register_major(int major)
/* Something failed. Do the cleanup and return rc. */ /* Something failed. Do the cleanup and return rc. */
out_error: out_error:
/* We rely on kfree to do the != NULL check. */ /* We rely on kfree to do the != NULL check. */
kfree(gd_sizes);
kfree(gd_part); kfree(gd_part);
kfree(gd_flags); kfree(gd_flags);
kfree(gd_de_arr); kfree(gd_de_arr);
...@@ -147,7 +141,6 @@ dasd_register_major(int major) ...@@ -147,7 +141,6 @@ dasd_register_major(int major)
static void static void
dasd_unregister_major(struct major_info * mi) dasd_unregister_major(struct major_info * mi)
{ {
int *bs;
int major, rc; int major, rc;
if (mi == NULL) if (mi == NULL)
...@@ -164,7 +157,6 @@ dasd_unregister_major(struct major_info * mi) ...@@ -164,7 +157,6 @@ dasd_unregister_major(struct major_info * mi)
/* Clear block device pointers. */ /* Clear block device pointers. */
major = mi->gendisk.major; major = mi->gendisk.major;
blk_dev[major].queue = NULL; blk_dev[major].queue = NULL;
bs = blk_size[major];
blk_clear(major); blk_clear(major);
rc = unregister_blkdev(major, "dasd"); rc = unregister_blkdev(major, "dasd");
...@@ -174,7 +166,6 @@ dasd_unregister_major(struct major_info * mi) ...@@ -174,7 +166,6 @@ dasd_unregister_major(struct major_info * mi)
major, rc); major, rc);
/* Free memory. */ /* Free memory. */
kfree(bs);
kfree(mi->gendisk.part); kfree(mi->gendisk.part);
kfree(mi->gendisk.flags); kfree(mi->gendisk.flags);
kfree(mi->gendisk.de_arr); kfree(mi->gendisk.de_arr);
...@@ -340,11 +331,6 @@ dasd_destroy_partitions(dasd_device_t * device) ...@@ -340,11 +331,6 @@ dasd_destroy_partitions(dasd_device_t * device)
wipe_partitions(device->kdev); wipe_partitions(device->kdev);
/* FIXME: do we really need that */
minor = minor(device->kdev);
for (i = 0; i < (1 << DASD_PARTN_BITS); i++)
gdp->sizes[minor + i] = 0;
/* /*
* This is confusing. The funcions is devfs_register_partitions * This is confusing. The funcions is devfs_register_partitions
* but the 1 as third parameter makes it do an unregister... * but the 1 as third parameter makes it do an unregister...
......
...@@ -447,40 +447,6 @@ static int dasd_ioctl_set_ro(void *inp, int no, long args) ...@@ -447,40 +447,6 @@ static int dasd_ioctl_set_ro(void *inp, int no, long args)
return 0; return 0;
} }
/*
* Return device size in number of sectors.
*/
static int dasd_ioctl_blkgetsize(void *inp, int no, long args)
{
struct gendisk *gdp;
kdev_t kdev;
long blocks;
kdev = ((struct inode *) inp)->i_rdev;
gdp = dasd_gendisk_from_major(major(kdev));
if (gdp == NULL)
return -EINVAL;
blocks = gdp->sizes[minor(kdev)] << 1;
return put_user(blocks, (long *) args);
}
/*
* Return device size in number of sectors, 64bit version.
*/
static int dasd_ioctl_blkgetsize64(void *inp, int no, long args)
{
struct gendisk *gdp;
kdev_t kdev;
u64 blocks;
kdev = ((struct inode *) inp)->i_rdev;
gdp = dasd_gendisk_from_major(major(kdev));
if (gdp == NULL)
return -EINVAL;
blocks = gdp->sizes[minor(kdev)] << 1;
return put_user(blocks << 10, (u64 *) args);
}
/* /*
* Reread partition table. * Reread partition table.
*/ */
...@@ -549,8 +515,6 @@ static struct { int no; dasd_ioctl_fn_t fn; } dasd_ioctls[] = ...@@ -549,8 +515,6 @@ static struct { int no; dasd_ioctl_fn_t fn; } dasd_ioctls[] =
{ BIODASDINFO2, dasd_ioctl_information }, { BIODASDINFO2, dasd_ioctl_information },
{ BIODASDPRRD, dasd_ioctl_read_profile }, { BIODASDPRRD, dasd_ioctl_read_profile },
{ BIODASDPRRST, dasd_ioctl_reset_profile }, { BIODASDPRRST, dasd_ioctl_reset_profile },
{ BLKGETSIZE, dasd_ioctl_blkgetsize },
{ BLKGETSIZE64, dasd_ioctl_blkgetsize64 },
{ BLKROSET, dasd_ioctl_set_ro }, { BLKROSET, dasd_ioctl_set_ro },
{ BLKRRPART, dasd_ioctl_rr_partition }, { BLKRRPART, dasd_ioctl_rr_partition },
{ DASDAPIVER, dasd_ioctl_api_version }, { DASDAPIVER, dasd_ioctl_api_version },
......
...@@ -90,7 +90,6 @@ struct hd_struct *sd; ...@@ -90,7 +90,6 @@ struct hd_struct *sd;
static Scsi_Disk ** sd_dsk_arr; static Scsi_Disk ** sd_dsk_arr;
static rwlock_t sd_dsk_arr_lock = RW_LOCK_UNLOCKED; static rwlock_t sd_dsk_arr_lock = RW_LOCK_UNLOCKED;
static int *sd_sizes;
static int *sd_max_sectors; static int *sd_max_sectors;
static int check_scsidisk_media_change(kdev_t); static int check_scsidisk_media_change(kdev_t);
...@@ -536,7 +535,7 @@ static int sd_open(struct inode *inode, struct file *filp) ...@@ -536,7 +535,7 @@ static int sd_open(struct inode *inode, struct file *filp)
* See if we are requesting a non-existent partition. Do this * See if we are requesting a non-existent partition. Do this
* after checking for disk change. * after checking for disk change.
*/ */
if (sd_sizes[SD_PARTITION(inode->i_rdev)] == 0) { if (sd[SD_PARTITION(inode->i_rdev)].nr_sects == 0) {
goto error_out; goto error_out;
} }
...@@ -1225,15 +1224,13 @@ static int sd_init() ...@@ -1225,15 +1224,13 @@ static int sd_init()
sd_dsk_arr[k] = sdkp; sd_dsk_arr[k] = sdkp;
} }
} }
init_mem_lth(sd_sizes, maxparts);
init_mem_lth(sd, maxparts); init_mem_lth(sd, maxparts);
init_mem_lth(sd_gendisks, N_USED_SD_MAJORS); init_mem_lth(sd_gendisks, N_USED_SD_MAJORS);
init_mem_lth(sd_max_sectors, sd_template.dev_max << 4); init_mem_lth(sd_max_sectors, sd_template.dev_max << 4);
if (!sd_dsk_arr || !sd_sizes || !sd || !sd_gendisks) if (!sd_dsk_arr || !sd || !sd_gendisks)
goto cleanup_mem; goto cleanup_mem;
zero_mem_lth(sd_sizes, maxparts);
zero_mem_lth(sd, maxparts); zero_mem_lth(sd, maxparts);
for (k = 0; k < maxparts; k++) { for (k = 0; k < maxparts; k++) {
...@@ -1266,7 +1263,6 @@ static int sd_init() ...@@ -1266,7 +1263,6 @@ static int sd_init()
sd_gendisks[k].major_name = "sd"; sd_gendisks[k].major_name = "sd";
sd_gendisks[k].minor_shift = 4; sd_gendisks[k].minor_shift = 4;
sd_gendisks[k].part = sd + k * (N << 4); sd_gendisks[k].part = sd + k * (N << 4);
sd_gendisks[k].sizes = sd_sizes + k * (N << 4);
sd_gendisks[k].nr_real = 0; sd_gendisks[k].nr_real = 0;
} }
return 0; return 0;
...@@ -1286,8 +1282,6 @@ static int sd_init() ...@@ -1286,8 +1282,6 @@ static int sd_init()
sd_gendisks = NULL; sd_gendisks = NULL;
vfree(sd); vfree(sd);
sd = NULL; sd = NULL;
vfree(sd_sizes);
sd_sizes = NULL;
if (sd_dsk_arr) { if (sd_dsk_arr) {
for (k = 0; k < sd_template.dev_max; ++k) for (k = 0; k < sd_template.dev_max; ++k)
vfree(sd_dsk_arr[k]); vfree(sd_dsk_arr[k]);
...@@ -1326,7 +1320,6 @@ static void sd_finish() ...@@ -1326,7 +1320,6 @@ static void sd_finish()
if (sdkp && (0 == sdkp->capacity) && sdkp->device) { if (sdkp && (0 == sdkp->capacity) && sdkp->device) {
sd_init_onedisk(sdkp, k); sd_init_onedisk(sdkp, k);
if (!sdkp->has_been_registered) { if (!sdkp->has_been_registered) {
sd_sizes[k << 4] = sdkp->capacity;
register_disk(&SD_GENDISK(k), MKDEV_SD(k), register_disk(&SD_GENDISK(k), MKDEV_SD(k),
1<<4, &sd_fops, 1<<4, &sd_fops,
sdkp->capacity); sdkp->capacity);
...@@ -1486,7 +1479,7 @@ static void sd_detach(Scsi_Device * sdp) ...@@ -1486,7 +1479,7 @@ static void sd_detach(Scsi_Device * sdp)
{ {
Scsi_Disk *sdkp = NULL; Scsi_Disk *sdkp = NULL;
kdev_t dev; kdev_t dev;
int dsk_nr, j; int dsk_nr;
int max_p; int max_p;
int start; int start;
unsigned long iflags; unsigned long iflags;
...@@ -1515,9 +1508,6 @@ static void sd_detach(Scsi_Device * sdp) ...@@ -1515,9 +1508,6 @@ static void sd_detach(Scsi_Device * sdp)
driverfs_remove_partitions(&SD_GENDISK (dsk_nr), driverfs_remove_partitions(&SD_GENDISK (dsk_nr),
SD_MINOR_NUMBER (start)); SD_MINOR_NUMBER (start));
wipe_partitions(dev); wipe_partitions(dev);
for (j = max_p - 1; j >= 0; j--)
sd_sizes[start + j] = 0;
devfs_register_partitions (&SD_GENDISK (dsk_nr), devfs_register_partitions (&SD_GENDISK (dsk_nr),
SD_MINOR_NUMBER (start), 1); SD_MINOR_NUMBER (start), 1);
/* unregister_disk() */ /* unregister_disk() */
...@@ -1567,7 +1557,6 @@ static void __exit exit_sd(void) ...@@ -1567,7 +1557,6 @@ static void __exit exit_sd(void)
vfree(sd_dsk_arr[k]); vfree(sd_dsk_arr[k]);
vfree(sd_dsk_arr); vfree(sd_dsk_arr);
} }
vfree(sd_sizes);
vfree((char *) sd); vfree((char *) sd);
for (k = 0; k < N_USED_SD_MAJORS; k++) { for (k = 0; k < N_USED_SD_MAJORS; k++) {
blk_dev[SD_MAJOR(k)].queue = NULL; blk_dev[SD_MAJOR(k)].queue = NULL;
......
...@@ -404,13 +404,8 @@ static void check_partition(struct gendisk *hd, kdev_t dev) ...@@ -404,13 +404,8 @@ static void check_partition(struct gendisk *hd, kdev_t dev)
setup_devfs: setup_devfs:
blkdev_put(bdev, BDEV_RAW); blkdev_put(bdev, BDEV_RAW);
out: out:
/* Setup driverfs tree */
if (hd->sizes)
driverfs_create_partitions(hd, minor(dev)); driverfs_create_partitions(hd, minor(dev));
else devfs_register_partitions (hd, minor(dev), 0);
driverfs_remove_partitions(hd, minor(dev));
devfs_register_partitions (hd, minor(dev), hd->sizes ? 0 : 1);
} }
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
...@@ -536,36 +531,17 @@ void grok_partitions(kdev_t dev, long size) ...@@ -536,36 +531,17 @@ void grok_partitions(kdev_t dev, long size)
} }
end_minor = first_minor + minors; end_minor = first_minor + minors;
if (!g->sizes)
blk_size[g->major] = NULL;
g->part[first_minor].nr_sects = size; g->part[first_minor].nr_sects = size;
/* No minors to use for partitions */ /* No minors to use for partitions */
if (minors == 1) if (minors == 1)
return; return;
if (g->sizes) {
g->sizes[first_minor] = size >> (BLOCK_SIZE_BITS - 9);
for (i = first_minor + 1; i < end_minor; i++)
g->sizes[i] = 0;
}
blk_size[g->major] = g->sizes;
/* No such device (e.g., media were just removed) */ /* No such device (e.g., media were just removed) */
if (!size) if (!size)
return; return;
check_partition(g, mk_kdev(g->major, first_minor)); check_partition(g, mk_kdev(g->major, first_minor));
/*
* We need to set the sizes array before we will be able to access
* any of the partitions on this device.
*/
if (g->sizes != NULL) { /* optional safeguard in ll_rw_blk.c */
for (i = first_minor; i < end_minor; i++)
g->sizes[i] = g->part[i].nr_sects >> (BLOCK_SIZE_BITS - 9);
}
} }
unsigned char *read_dev_sector(struct block_device *bdev, unsigned long n, Sector *p) unsigned char *read_dev_sector(struct block_device *bdev, unsigned long n, Sector *p)
......
...@@ -75,7 +75,6 @@ struct gendisk { ...@@ -75,7 +75,6 @@ struct gendisk {
get real minor */ get real minor */
struct hd_struct *part; /* [indexed by minor] */ struct hd_struct *part; /* [indexed by minor] */
int *sizes; /* [idem], device size in blocks */
int nr_real; /* number of real devices */ int nr_real; /* number of real devices */
struct gendisk *next; struct gendisk *next;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment