Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Viro <viro@math.psu.edu>2002-07-31 23:31:06 -0700
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-07-31 23:31:06 -0700
commit143fe0af17a2a5b229e67d91cf32687a72b4f3d7 (patch)
tree3878c69315442dcf195089c3d166b1c0dee23bb2
parentcfd17071e7f4855823f9cd85937bb182c7148b9f (diff)
[PATCH] Get rid of per-partition blk_size[]
kills use of blk_size[] for partitioned devices, removes ->sizes from struct gendisk.
-rw-r--r--drivers/acorn/block/mfmhd.c2
-rw-r--r--drivers/block/DAC960.c4
-rw-r--r--drivers/block/DAC960.h1
-rw-r--r--drivers/block/acsi.c2
-rw-r--r--drivers/block/blkpg.c4
-rw-r--r--drivers/block/cciss.c15
-rw-r--r--drivers/block/cpqarray.c25
-rw-r--r--drivers/block/genhd.c4
-rw-r--r--drivers/block/paride/pd.c2
-rw-r--r--drivers/block/ps2esdi.c2
-rw-r--r--drivers/block/umem.c9
-rw-r--r--drivers/block/xd.c2
-rw-r--r--drivers/ide/ataraid.c3
-rw-r--r--drivers/ide/hd.c2
-rw-r--r--drivers/ide/ide-cd.c4
-rw-r--r--drivers/ide/main.c1
-rw-r--r--drivers/ide/probe.c6
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/message/i2o/i2o_block.c8
-rw-r--r--drivers/mtd/ftl.c2
-rw-r--r--drivers/mtd/nftlcore.c7
-rw-r--r--drivers/s390/block/dasd_genhd.c16
-rw-r--r--drivers/s390/block/dasd_ioctl.c36
-rw-r--r--drivers/scsi/sd.c17
-rw-r--r--fs/partitions/check.c28
-rw-r--r--include/linux/genhd.h1
26 files changed, 22 insertions, 183 deletions
diff --git a/drivers/acorn/block/mfmhd.c b/drivers/acorn/block/mfmhd.c
index 309fc7c4d47d..b2a1c64a1467 100644
--- a/drivers/acorn/block/mfmhd.c
+++ b/drivers/acorn/block/mfmhd.c
@@ -194,7 +194,6 @@ struct mfm_info {
#define MFM_DRV_INFO mfm_info[raw_cmd.dev]
static struct hd_struct mfm[MFM_MAXDRIVES << 6];
-static int mfm_sizes[MFM_MAXDRIVES << 6];
/* Stuff from the assembly routines */
extern unsigned int hdc63463_baseaddress; /* Controller base address */
@@ -1259,7 +1258,6 @@ static struct gendisk mfm_gendisk = {
major_name: "mfm",
minor_shift: 6,
part: mfm,
- sizes: mfm_sizes,
};
static struct block_device_operations mfm_fops =
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index be68e7e539bc..28b01f63d0b6 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -1961,7 +1961,6 @@ static boolean DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller)
Controller->MaxSectorsPerRequest[MinorNumber] =
Controller->MaxBlocksPerCommand;
Controller->GenericDiskInfo.part = Controller->DiskPartitions;
- Controller->GenericDiskInfo.sizes = Controller->PartitionSizes;
/*
Complete initialization of the Generic Disk Information structure.
*/
@@ -2003,7 +2002,6 @@ static void DAC960_UnregisterBlockDevice(DAC960_Controller_T *Controller)
array, Max Sectors per Request array, and Max Segments per Request array.
*/
Controller->GenericDiskInfo.part = NULL;
- Controller->GenericDiskInfo.sizes = NULL;
blk_clear(MajorNumber);
/*
Remove the Generic Disk Information structure from the list.
@@ -5295,7 +5293,7 @@ static int DAC960_Open(Inode_T *Inode, File_T *File)
DAC960_ComputeGenericDiskInfo(Controller);
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;
/*
Increment Controller and Logical Drive Usage Counts.
diff --git a/drivers/block/DAC960.h b/drivers/block/DAC960.h
index 55e9ffed5391..dad9ca443bf1 100644
--- a/drivers/block/DAC960.h
+++ b/drivers/block/DAC960.h
@@ -2473,7 +2473,6 @@ typedef struct DAC960_Controller
} V2;
} FW;
DiskPartition_T DiskPartitions[DAC960_MinorCount];
- int PartitionSizes[DAC960_MinorCount];
unsigned char ProgressBuffer[DAC960_ProgressBufferSize];
unsigned char UserStatusBuffer[DAC960_UserMessageSize];
}
diff --git a/drivers/block/acsi.c b/drivers/block/acsi.c
index 0e1aa84e691b..3316fcd57208 100644
--- a/drivers/block/acsi.c
+++ b/drivers/block/acsi.c
@@ -245,7 +245,6 @@ char *acsi_buffer;
unsigned long phys_acsi_buffer;
static int NDevices = 0;
-static int acsi_sizes[MAX_DEV<<4] = { 0, };
static struct hd_struct acsi_part[MAX_DEV<<4] = { {0,0}, };
static int access_count[MAX_DEV] = { 0, };
@@ -1359,7 +1358,6 @@ static struct gendisk acsi_gendisk = {
major_name: "ad",
minor_shift: 4,
part: acsi_part,
- sizes: acsi_sizes,
fops: &acsi_fops,
};
diff --git a/drivers/block/blkpg.c b/drivers/block/blkpg.c
index 83826af84b6a..f38dfe33c8d9 100644
--- a/drivers/block/blkpg.c
+++ b/drivers/block/blkpg.c
@@ -109,8 +109,6 @@ int add_partition(struct block_device *bdev, struct blkpg_partition *p)
/* all seems OK */
part[p->pno].start_sect = pstart;
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);
return 0;
}
@@ -163,8 +161,6 @@ int del_partition(struct block_device *bdev, struct blkpg_partition *p)
part[p->pno].start_sect = 0;
part[p->pno].nr_sects = 0;
- if (g->sizes)
- g->sizes[minor(dev) + p->pno] = 0;
devfs_register_partitions (g, minor(dev), 0);
bd_release(bdevp);
bdput(bdevp);
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 360a1468e5c0..f8a34fe2bb85 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -348,8 +348,7 @@ static void cciss_geninit( int ctlr)
drv = &(hba[ctlr]->drv[i]);
if( !(drv->nr_blocks))
continue;
- hba[ctlr]->hd[i << NWD_SHIFT].nr_sects =
- hba[ctlr]->sizes[i << NWD_SHIFT] = drv->nr_blocks;
+ hba[ctlr]->hd[i << NWD_SHIFT].nr_sects = drv->nr_blocks;
//hba[ctlr]->gendisk.nr_real++;
(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)
* but I'm already using way to many device nodes to claim another one
* 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)
return -ENXIO;
if (!capable(CAP_SYS_ADMIN))
@@ -806,7 +805,6 @@ static int revalidate_allvol(kdev_t dev)
* 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]->sizes, 0, sizeof(int) * 256);
memset(hba[ctlr]->drv, 0, sizeof(drive_info_struct)
* CISS_MAX_LUN);
hba[ctlr]->gendisk.nr_real = 0;
@@ -823,7 +821,7 @@ static int revalidate_allvol(kdev_t dev)
cciss_geninit(ctlr);
for(i=0; i<NWD; i++) {
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);
}
@@ -836,7 +834,7 @@ static int deregister_disk(int ctlr, int logvol)
unsigned long flags;
struct gendisk *gdev = &(hba[ctlr]->gendisk);
ctlr_info_t *h = hba[ctlr];
- int start, max_p, i;
+ int start, max_p;
if (!capable(CAP_SYS_RAWIO))
@@ -856,8 +854,6 @@ static int deregister_disk(int ctlr, int logvol)
max_p = 1 << gdev->minor_shift;
start = logvol << gdev->minor_shift;
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 */
if (logvol == h->highest_lun)
{
@@ -866,7 +862,7 @@ static int deregister_disk(int ctlr, int logvol)
for(i=0; i<h->highest_lun; i++)
{
/* 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;
}
h->highest_lun = newhighest;
@@ -2498,7 +2494,6 @@ static int __init cciss_init_one(struct pci_dev *pdev,
hba[i]->gendisk.major_name = "cciss";
hba[i]->gendisk.minor_shift = NWD_SHIFT;
hba[i]->gendisk.part = hba[i]->hd;
- hba[i]->gendisk.sizes = hba[i]->sizes;
hba[i]->gendisk.nr_real = hba[i]->highest_lun+1;
/* Get on the disk list */
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 902108341ce5..4a4376ae7384 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -104,7 +104,6 @@ static struct board_type products[] = {
};
static struct hd_struct * ida;
-static int * ida_sizes;
static struct gendisk ida_gendisk[MAX_CTLR];
static struct proc_dir_entry *proc_array;
@@ -176,9 +175,7 @@ static void ida_geninit(int ctlr)
drv = &hba[ctlr]->drv[i];
if (!drv->nr_blks)
continue;
- ida[(ctlr<<CTLR_SHIFT) + (i<<NWD_SHIFT)].nr_sects =
- ida_sizes[(ctlr<<CTLR_SHIFT) + (i<<NWD_SHIFT)] =
- drv->nr_blks;
+ ida[(ctlr<<CTLR_SHIFT) + (i<<NWD_SHIFT)].nr_sects = drv->nr_blks;
(BLK_DEFAULT_QUEUE(MAJOR_NR + ctlr))->hardsect_size = drv->blk_size;
ida_gendisk[ctlr].nr_real++;
@@ -339,7 +336,6 @@ void cleanup_module(void)
devfs_find_and_unregister(NULL, "ida", 0, 0, 0, 0);
remove_proc_entry("cpqarray", proc_root_driver);
kfree(ida);
- kfree(ida_sizes);
}
#endif /* MODULE */
@@ -372,16 +368,7 @@ int __init cpqarray_init(void)
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_sizes, 0, sizeof(int)*nr_ctlr*NWD*16);
memset(ida_gendisk, 0, sizeof(struct gendisk)*MAX_CTLR);
/*
@@ -437,7 +424,6 @@ int __init cpqarray_init(void)
if (num_cntlrs_reg == 0)
{
kfree(ida);
- kfree(ida_sizes);
}
return(num_cntlrs_reg);
@@ -469,7 +455,6 @@ int __init cpqarray_init(void)
ida_gendisk[i].major_name = "ida";
ida_gendisk[i].minor_shift = NWD_SHIFT;
ida_gendisk[i].part = ida + (i*256);
- ida_gendisk[i].sizes = ida_sizes + (i*256);
ida_gendisk[i].nr_real = 0;
ida_gendisk[i].de_arr = de_arr[i];
ida_gendisk[i].fops = &ida_fops;
@@ -770,8 +755,7 @@ static int ida_open(struct inode *inode, struct file *filep)
if (ctlr > MAX_CTLR || hba[ctlr] == NULL)
return -ENXIO;
- if (!capable(CAP_SYS_RAWIO) && ida_sizes[(ctlr << CTLR_SHIFT) +
- minor(inode->i_rdev)] == 0)
+ if (!capable(CAP_SYS_RAWIO) && inode->i_bdev->bd_inode->i_size == 0)
return -ENXIO;
/*
@@ -781,7 +765,7 @@ static int ida_open(struct inode *inode, struct file *filep)
* for "raw controller".
*/
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)
return -ENXIO;
@@ -1498,7 +1482,6 @@ static int revalidate_allvol(kdev_t dev)
* 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_sizes+(ctlr*256), 0, sizeof(int)*NWD*16);
memset(hba[ctlr]->drv, 0, sizeof(drv_info_t)*NWD);
ida_gendisk[ctlr].nr_real = 0;
@@ -1514,7 +1497,7 @@ static int revalidate_allvol(kdev_t dev)
ida_geninit(ctlr);
for(i=0; i<NWD; i++) {
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);
}
diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c
index b6ccf4729968..313b2eea6189 100644
--- a/drivers/block/genhd.c
+++ b/drivers/block/genhd.c
@@ -157,8 +157,8 @@ static int show_partition(struct seq_file *part, void *v)
int minormask = (1<<sgp->minor_shift) - 1;
if ((n & minormask) && sgp->part[n].nr_sects == 0)
continue;
- seq_printf(part, "%4d %4d %10d %s\n",
- sgp->major, n, sgp->sizes[n],
+ seq_printf(part, "%4d %4d %10ld %s\n",
+ sgp->major, n, sgp->part[n].nr_sects << 1,
disk_name(sgp, n, buf));
}
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index a54a532bc70c..2daf420f0ebe 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -272,7 +272,6 @@ static int pd_check_media(kdev_t dev);
static void pd_eject( int unit);
static struct hd_struct pd_hd[PD_DEVS];
-static int pd_sizes[PD_DEVS];
#define PD_NAMELEN 8
@@ -332,7 +331,6 @@ static struct gendisk pd_gendisk = {
major_name: PD_NAME,
minor_shift: PD_BITS,
part: pd_hd,
- sizes: pd_sizes,
fops: &pd_fops,
};
diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c
index 93d5bcf5cb12..61bf283ec808 100644
--- a/drivers/block/ps2esdi.c
+++ b/drivers/block/ps2esdi.c
@@ -110,7 +110,6 @@ static u_int dma_arb_level; /* DMA arbitration level */
static DECLARE_WAIT_QUEUE_HEAD(ps2esdi_int);
static int no_int_yet;
-static int ps2esdi_sizes[MAX_HD << 6];
static int ps2esdi_drives;
static struct hd_struct ps2esdi[MAX_HD << 6];
static u_short io_base;
@@ -155,7 +154,6 @@ static struct gendisk ps2esdi_gendisk =
major_name: "ed",
minor_shift: 6,
part: ps2esdi,
- sizes: ps2esdi_sizes,
fops: &ps2esdi_fops,
};
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 5fd0fd2de2ae..58d6fc51fd38 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -160,7 +160,6 @@ static struct block_device_operations mm_fops;
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 int num_cards = 0;
@@ -1206,7 +1205,6 @@ int __init mm_init(void)
printk(KERN_INFO DRIVER_VERSION " : " DRIVER_DESC "\n");
memset (cards, 0, MM_MAXCARDS * sizeof(struct cardinfo));
- memset (mm_sizes, 0, (MM_MAXCARDS << MM_SHIFT) * sizeof (int));
memset (mm_partitions, 0,
(MM_MAXCARDS << MM_SHIFT) * sizeof(struct hd_struct));
@@ -1224,11 +1222,6 @@ int __init mm_init(void)
/* 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++) {
spin_lock_init(&cards[i].lock);
mm_partitions[i << MM_SHIFT].nr_sects =
cards[i].mm_size * (1024 / MM_HARDSECT);
@@ -1271,8 +1264,6 @@ void __exit mm_cleanup(void)
unregister_blkdev(MAJOR_NR, "umem");
- blk_size [MAJOR_NR] = NULL;
-
/*
* Get our gendisk structure off the list.
*/
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index cbb195f05c96..68863f3067a0 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -122,7 +122,6 @@ static unsigned int xd_bases[] __initdata =
};
static struct hd_struct xd_struct[XD_MAXDRIVES << 6];
-static int xd_sizes[XD_MAXDRIVES << 6];
static spinlock_t xd_lock = SPIN_LOCK_UNLOCKED;
@@ -133,7 +132,6 @@ static struct gendisk xd_gendisk = {
major_name: "xd",
minor_shift: 6,
part: xd_struct,
- sizes: xd_sizes,
fops: &xd_fops,
};
diff --git a/drivers/ide/ataraid.c b/drivers/ide/ataraid.c
index 04520f4e3fbf..0a6b6ec91baa 100644
--- a/drivers/ide/ataraid.c
+++ b/drivers/ide/ataraid.c
@@ -45,7 +45,6 @@ static void ataraid_split_request(request_queue_t * q, int rw,
struct gendisk ataraid_gendisk;
-static int ataraid_gendisk_sizes[256];
static int ataraid_readahead[256];
static struct block_device_operations ataraid_fops = {
@@ -257,7 +256,6 @@ static __init int ataraid_init(void)
ataraid_gendisk.major = ATAMAJOR;
ataraid_gendisk.major_name = "ataraid";
ataraid_gendisk.minor_shift = 4;
- ataraid_gendisk.sizes = &ataraid_gendisk_sizes[0];
ataraid_gendisk.nr_real = 16;
ataraid_gendisk.fops = &ataraid_fops;
@@ -282,7 +280,6 @@ static __init int ataraid_init(void)
static void __exit ataraid_exit(void)
{
unregister_blkdev(ATAMAJOR, "ataraid");
- blk_size[ATAMAJOR] = NULL;
del_gendisk(&ataraid_gendisk);
diff --git a/drivers/ide/hd.c b/drivers/ide/hd.c
index 6441cad4816b..07c83415f587 100644
--- a/drivers/ide/hd.c
+++ b/drivers/ide/hd.c
@@ -148,7 +148,6 @@ static int NR_HD;
#endif
static struct hd_struct hd[MAX_HD<<6];
-static int hd_sizes[MAX_HD<<6];
static struct timer_list device_timer;
@@ -714,7 +713,6 @@ static struct gendisk hd_gendisk = {
.major_name = "hd",
.minor_shift = 6,
.part = hd,
- .sizes = hd_sizes,
.fops = &hd_fops,
};
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 0eb454a5c8a3..4ef0d796b404 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2012,7 +2012,6 @@ static int cdrom_read_toc(struct ata_device *drive, struct request_sense *sense)
if (stat)
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;
/* Remember that we've read this stuff. */
@@ -2878,7 +2877,6 @@ void ide_cdrom_revalidate(struct ata_device *drive)
{
struct cdrom_info *info = drive->driver_data;
struct atapi_toc *toc;
- int minor = drive->select.b.unit << PARTN_BITS;
struct request_sense sense;
cdrom_read_toc(drive, &sense);
@@ -2890,8 +2888,6 @@ void ide_cdrom_revalidate(struct ata_device *drive)
/* for general /dev/cdrom like mounting, one big disc */
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)
diff --git a/drivers/ide/main.c b/drivers/ide/main.c
index a14e7934ed16..38541845345e 100644
--- a/drivers/ide/main.c
+++ b/drivers/ide/main.c
@@ -491,7 +491,6 @@ void ide_unregister(struct ata_channel *ch)
gd = ch->gd;
if (gd) {
del_gendisk(gd);
- kfree(gd->sizes);
kfree(gd->part);
if (gd->de_arr)
kfree (gd->de_arr);
diff --git a/drivers/ide/probe.c b/drivers/ide/probe.c
index 801c178f559a..08113bc0e4e5 100644
--- a/drivers/ide/probe.c
+++ b/drivers/ide/probe.c
@@ -1108,10 +1108,6 @@ static void channel_init(struct ata_channel *ch)
goto err_kmalloc_gd;
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);
if (!gd->part)
@@ -1164,8 +1160,6 @@ err_kmalloc_gd_flags:
err_kmalloc_gd_de_arr:
kfree(gd->part);
err_kmalloc_gd_part:
- kfree(gd->sizes);
-err_kmalloc_gd_sizes:
kfree(gd);
err_kmalloc_gd:
printk(KERN_CRIT "(%s) Out of memory\n", __FUNCTION__);
diff --git a/drivers/md/md.c b/drivers/md/md.c
index a4f962c3a469..55f1d3990ef4 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -122,7 +122,6 @@ static struct gendisk md_gendisk=
.major_name = "md",
.minor_shift = 0,
.part = md_hd_struct,
- .sizes = md_size,
.nr_real = MAX_MD_DEVS,
.next = NULL,
.fops = &md_fops,
@@ -3177,7 +3176,6 @@ static void md_geninit(void)
for(i = 0; i < MAX_MD_DEVS; i++) {
md_size[i] = 0;
}
- blk_size[MAJOR_NR] = md_size;
dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t));
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index b82610655b49..8866c446d738 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -124,7 +124,6 @@
* 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_context;
@@ -731,7 +730,6 @@ static int i2ob_evt(void *dummy)
{
for(i = unit; i <= unit+15; i++)
{
- i2ob_sizes[i] = 0;
blk_queue_max_sectors(i2ob_dev[i].req_queue, 0);
i2ob[i].nr_sects = 0;
i2ob_gendisk.part[i].nr_sects = 0;
@@ -767,7 +765,6 @@ static int i2ob_evt(void *dummy)
i2ob_query_device(&i2ob_dev[unit], 0x0000, 4, &size, 8);
spin_lock_irqsave(&I2O_LOCK(unit), flags);
- i2ob_sizes[unit] = (int)(size>>10);
i2ob_gendisk.part[unit].nr_sects = size>>9;
i2ob[unit].nr_sects = (int)(size>>9);
spin_unlock_irqrestore(&I2O_LOCK(unit), flags);
@@ -1081,7 +1078,7 @@ static int i2ob_ioctl(struct inode *inode, struct file *file,
{
struct hd_geometry g;
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.start = get_start_sect(inode->i_bdev);
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
i2ob_query_device(dev, 0x0000, 5, &flags, 4);
i2ob_query_device(dev, 0x0000, 6, &status, 4);
- i2ob_sizes[unit] = (int)(size>>10);
i2ob_gendisk.part[unit].nr_sects = 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)
for(i = unit; i <= unit+15; i++)
{
i2ob_dev[i].i2odev = NULL;
- i2ob_sizes[i] = 0;
blk_queue_max_sectors(i2ob_dev[i].req_queue, 0);
i2ob[i].nr_sects = 0;
i2ob_gendisk.part[i].nr_sects = 0;
@@ -1762,7 +1757,6 @@ static struct gendisk i2ob_gendisk =
major_name: "i2o/hd",
minor_shift: 4,
part: i2ob,
- sizes: i2ob_sizes,
nr_real: MAX_I2OB,
fops: &i2ob_fops,
};
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index c68d10d829f9..4bef6d80fd9d 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -175,14 +175,12 @@ static struct mtd_notifier ftl_notifier = {
#define XFER_FAILED 0x04
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 = {
major: FTL_MAJOR,
major_name: "ftl",
minor_shift: PART_BITS,
part: ftl_hd,
- sizes: ftl_sizes,
};
/*====================================================================*/
diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c
index f54e17f14540..07a6e7c01f88 100644
--- a/drivers/mtd/nftlcore.c
+++ b/drivers/mtd/nftlcore.c
@@ -24,6 +24,7 @@
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/blkpg.h>
+#include <linux/buffer_head.h>
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
@@ -52,17 +53,16 @@
* encountered, except ...
*/
-static int nftl_sizes[256];
-
/* .. for the Linux partition table handling. */
+/* So why didn't you fucking go and clean it up? -- AV */
struct hd_struct part_table[256];
+static struct block_device_operations nftl_fops;
static struct gendisk nftl_gendisk = {
major: MAJOR_NR,
major_name: "nftl",
minor_shift: NFTL_PARTN_BITS, /* # of partition bits */
part: part_table, /* hd struct */
- sizes: nftl_sizes, /* block sizes */
};
struct NFTLrecord *NFTLs[MAX_NFTLS];
@@ -143,7 +143,6 @@ static void NFTL_setup(struct mtd_info *mtd)
}
NFTLs[firstfree] = nftl;
/* Finally, set up the block device sizes */
- nftl_sizes[firstfree * 16] = nftl->nr_sects;
part_table[firstfree * 16].nr_sects = nftl->nr_sects;
nftl_gendisk.nr_real++;
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c
index 643a069a38f5..4fe0852e6423 100644
--- a/drivers/s390/block/dasd_genhd.c
+++ b/drivers/s390/block/dasd_genhd.c
@@ -66,7 +66,6 @@ dasd_register_major(int major)
struct major_info *mi;
struct hd_struct *gd_part;
devfs_handle_t *gd_de_arr;
- int *gd_sizes;
char *gd_flags;
int new_major, rc;
@@ -79,11 +78,10 @@ dasd_register_major(int major)
GFP_KERNEL);
gd_flags = kmalloc(DASD_PER_MAJOR * sizeof(char), GFP_KERNEL);
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. */
if (mi == NULL || gd_de_arr == NULL || gd_flags == NULL ||
- gd_part == NULL || gd_sizes == NULL) {
+ gd_part == NULL) {
MESSAGE(KERN_WARNING, "%s",
"Cannot get memory to allocate another "
"major number");
@@ -112,17 +110,14 @@ dasd_register_major(int major)
mi->gendisk.de_arr = gd_de_arr;
mi->gendisk.flags = gd_flags;
mi->gendisk.part = gd_part;
- mi->gendisk.sizes = gd_sizes;
/* Initialize the gendisk arrays. */
memset(gd_de_arr, 0, DASD_PER_MAJOR * sizeof(devfs_handle_t));
memset(gd_flags, 0, DASD_PER_MAJOR * sizeof (char));
memset(gd_part, 0, sizeof (struct hd_struct) << MINORBITS);
- memset(gd_sizes, 0, sizeof(int) << MINORBITS);
/* Setup block device pointers for the new major. */
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. */
spin_lock(&dasd_major_lock);
@@ -136,7 +131,6 @@ dasd_register_major(int major)
/* Something failed. Do the cleanup and return rc. */
out_error:
/* We rely on kfree to do the != NULL check. */
- kfree(gd_sizes);
kfree(gd_part);
kfree(gd_flags);
kfree(gd_de_arr);
@@ -147,7 +141,6 @@ out_error:
static void
dasd_unregister_major(struct major_info * mi)
{
- int *bs;
int major, rc;
if (mi == NULL)
@@ -164,7 +157,6 @@ dasd_unregister_major(struct major_info * mi)
/* Clear block device pointers. */
major = mi->gendisk.major;
blk_dev[major].queue = NULL;
- bs = blk_size[major];
blk_clear(major);
rc = unregister_blkdev(major, "dasd");
@@ -174,7 +166,6 @@ dasd_unregister_major(struct major_info * mi)
major, rc);
/* Free memory. */
- kfree(bs);
kfree(mi->gendisk.part);
kfree(mi->gendisk.flags);
kfree(mi->gendisk.de_arr);
@@ -340,11 +331,6 @@ dasd_destroy_partitions(dasd_device_t * device)
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
* but the 1 as third parameter makes it do an unregister...
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index beea10ab977d..e3705381dac3 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -448,40 +448,6 @@ static int dasd_ioctl_set_ro(void *inp, int no, long args)
}
/*
- * 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.
*/
static int dasd_ioctl_rr_partition(void *inp, int no, long args)
@@ -549,8 +515,6 @@ static struct { int no; dasd_ioctl_fn_t fn; } dasd_ioctls[] =
{ BIODASDINFO2, dasd_ioctl_information },
{ BIODASDPRRD, dasd_ioctl_read_profile },
{ BIODASDPRRST, dasd_ioctl_reset_profile },
- { BLKGETSIZE, dasd_ioctl_blkgetsize },
- { BLKGETSIZE64, dasd_ioctl_blkgetsize64 },
{ BLKROSET, dasd_ioctl_set_ro },
{ BLKRRPART, dasd_ioctl_rr_partition },
{ DASDAPIVER, dasd_ioctl_api_version },
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 556b92b3b3bf..67addc14739c 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -90,7 +90,6 @@ struct hd_struct *sd;
static Scsi_Disk ** sd_dsk_arr;
static rwlock_t sd_dsk_arr_lock = RW_LOCK_UNLOCKED;
-static int *sd_sizes;
static int *sd_max_sectors;
static int check_scsidisk_media_change(kdev_t);
@@ -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
* 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;
}
@@ -1225,15 +1224,13 @@ static int sd_init()
sd_dsk_arr[k] = sdkp;
}
}
- init_mem_lth(sd_sizes, maxparts);
init_mem_lth(sd, maxparts);
init_mem_lth(sd_gendisks, N_USED_SD_MAJORS);
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;
- zero_mem_lth(sd_sizes, maxparts);
zero_mem_lth(sd, maxparts);
for (k = 0; k < maxparts; k++) {
@@ -1266,7 +1263,6 @@ static int sd_init()
sd_gendisks[k].major_name = "sd";
sd_gendisks[k].minor_shift = 4;
sd_gendisks[k].part = sd + k * (N << 4);
- sd_gendisks[k].sizes = sd_sizes + k * (N << 4);
sd_gendisks[k].nr_real = 0;
}
return 0;
@@ -1286,8 +1282,6 @@ cleanup_mem:
sd_gendisks = NULL;
vfree(sd);
sd = NULL;
- vfree(sd_sizes);
- sd_sizes = NULL;
if (sd_dsk_arr) {
for (k = 0; k < sd_template.dev_max; ++k)
vfree(sd_dsk_arr[k]);
@@ -1326,7 +1320,6 @@ static void sd_finish()
if (sdkp && (0 == sdkp->capacity) && sdkp->device) {
sd_init_onedisk(sdkp, k);
if (!sdkp->has_been_registered) {
- sd_sizes[k << 4] = sdkp->capacity;
register_disk(&SD_GENDISK(k), MKDEV_SD(k),
1<<4, &sd_fops,
sdkp->capacity);
@@ -1486,7 +1479,7 @@ static void sd_detach(Scsi_Device * sdp)
{
Scsi_Disk *sdkp = NULL;
kdev_t dev;
- int dsk_nr, j;
+ int dsk_nr;
int max_p;
int start;
unsigned long iflags;
@@ -1515,9 +1508,6 @@ static void sd_detach(Scsi_Device * sdp)
driverfs_remove_partitions(&SD_GENDISK (dsk_nr),
SD_MINOR_NUMBER (start));
wipe_partitions(dev);
- for (j = max_p - 1; j >= 0; j--)
- sd_sizes[start + j] = 0;
-
devfs_register_partitions (&SD_GENDISK (dsk_nr),
SD_MINOR_NUMBER (start), 1);
/* unregister_disk() */
@@ -1567,7 +1557,6 @@ static void __exit exit_sd(void)
vfree(sd_dsk_arr[k]);
vfree(sd_dsk_arr);
}
- vfree(sd_sizes);
vfree((char *) sd);
for (k = 0; k < N_USED_SD_MAJORS; k++) {
blk_dev[SD_MAJOR(k)].queue = NULL;
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 462405eabad8..273b85b91732 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -404,13 +404,8 @@ static void check_partition(struct gendisk *hd, kdev_t dev)
setup_devfs:
blkdev_put(bdev, BDEV_RAW);
out:
- /* Setup driverfs tree */
- if (hd->sizes)
- driverfs_create_partitions(hd, minor(dev));
- else
- driverfs_remove_partitions(hd, minor(dev));
-
- devfs_register_partitions (hd, minor(dev), hd->sizes ? 0 : 1);
+ driverfs_create_partitions(hd, minor(dev));
+ devfs_register_partitions (hd, minor(dev), 0);
}
#ifdef CONFIG_DEVFS_FS
@@ -536,36 +531,17 @@ void grok_partitions(kdev_t dev, long size)
}
end_minor = first_minor + minors;
- if (!g->sizes)
- blk_size[g->major] = NULL;
-
g->part[first_minor].nr_sects = size;
/* No minors to use for partitions */
if (minors == 1)
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) */
if (!size)
return;
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)
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 93755fee7f36..f8ce7a12c7dd 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -75,7 +75,6 @@ struct gendisk {
get real minor */
struct hd_struct *part; /* [indexed by minor] */
- int *sizes; /* [idem], device size in blocks */
int nr_real; /* number of real devices */
struct gendisk *next;