Commit c4354130 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (2/15) big struct block_device * push (first series)

 - remove abuses of blksize_size[] and (late) hardsect_size[].  Mostly
   drivers/s390/char/*, BTW...
parent 77e722ec
......@@ -196,7 +196,6 @@ struct mfm_info {
static struct hd_struct mfm[MFM_MAXDRIVES << 6];
static int mfm_sizes[MFM_MAXDRIVES << 6];
static int mfm_blocksizes[MFM_MAXDRIVES << 6];
static int mfm_sectsizes[MFM_MAXDRIVES << 6];
static DECLARE_WAIT_QUEUE_HEAD(mfm_wait_open);
/* Stuff from the assembly routines */
......@@ -1319,10 +1318,8 @@ static void mfm_geninit (void)
for (i = 0; i < (MFM_MAXDRIVES << 6); i++) {
/* Can't increase this - if you do all hell breaks loose */
mfm_blocksizes[i] = 1024;
mfm_sectsizes[i] = 512;
}
blksize_size[MAJOR_NR] = mfm_blocksizes;
hardsect_size[MAJOR_NR] = mfm_sectsizes;
mfm_drives = mfm_initdrives();
......
......@@ -34,8 +34,6 @@
#include "ataraid.h"
static int ataraid_hardsect_size[256];
static int ataraid_blksize_size[256];
static struct raid_device_operations* ataraid_ops[16];
......@@ -239,17 +237,13 @@ static __init int ataraid_init(void)
int i;
for(i=0;i<256;i++)
{
ataraid_hardsect_size[i] = 512;
ataraid_blksize_size[i] = 1024;
ataraid_readahead[i] = 1023;
}
if (blksize_size[ATAMAJOR]==NULL)
blksize_size[ATAMAJOR] = ataraid_blksize_size;
if (hardsect_size[ATAMAJOR]==NULL)
hardsect_size[ATAMAJOR] = ataraid_hardsect_size;
/* setup the gendisk structure */
ataraid_gendisk.part = kmalloc(256 * sizeof(struct hd_struct),GFP_KERNEL);
if (ataraid_gendisk.part==NULL) {
......@@ -286,7 +280,6 @@ static __init int ataraid_init(void)
static void __exit ataraid_exit(void)
{
unregister_blkdev(ATAMAJOR, "ataraid");
hardsect_size[ATAMAJOR] = NULL;
blk_size[ATAMAJOR] = NULL;
blksize_size[ATAMAJOR] = NULL;
......
......@@ -723,13 +723,6 @@ dasd_register_major (major_info_t * major_info)
goto out_blksize_size;
memset (blksize_size[major], 0, (1 << MINORBITS) * sizeof (int));
/* init_hardsect_size */
hardsect_size[major] =
(int *) kmalloc ((1 << MINORBITS) * sizeof (int), GFP_ATOMIC);
if (!hardsect_size[major])
goto out_hardsect_size;
memset (hardsect_size[major], 0, (1 << MINORBITS) * sizeof (int));
/* finally do the gendisk stuff */
major_info->gendisk.part = kmalloc ((1 << MINORBITS) *
sizeof (struct hd_struct),
......@@ -748,10 +741,6 @@ dasd_register_major (major_info_t * major_info)
/* error handling - free the prior allocated memory */
out_gendisk:
kfree (hardsect_size[major]);
hardsect_size[major] = NULL;
out_hardsect_size:
kfree (blksize_size[major]);
blksize_size[major] = NULL;
......@@ -813,7 +802,6 @@ dasd_unregister_major (major_info_t * major_info)
kfree (blk_size[major]);
kfree (blksize_size[major]);
kfree (hardsect_size[major]);
blk_clear(major);
......@@ -3341,6 +3329,7 @@ dasd_setup_blkdev (dasd_device_t *device )
device->request_queue = kmalloc(sizeof(request_queue_t),GFP_KERNEL);
device->request_queue->queuedata = device;
blk_init_queue (device->request_queue, do_dasd_request);
blk_queue_hardsect_size(device->request_queue, device->sizes.bp_block);
elevator_init (&(device->request_queue->elevator),ELEVATOR_NOOP);
for (i = 0; i < (1 << DASD_PARTN_BITS); i++) {
......@@ -3350,7 +3339,6 @@ dasd_setup_blkdev (dasd_device_t *device )
sizes.s2b_shift) >> 1;
else
device->major_info->gendisk.sizes[minor + i] = 0;
hardsect_size[major][minor + i] = device->sizes.bp_block;
blksize_size[major][minor + i] = device->sizes.bp_block;
blk_queue_max_sectors(device->request_queue,
device->discipline->max_blocks << device->sizes.s2b_shift);
......@@ -3381,7 +3369,6 @@ dasd_disable_blkdev (dasd_device_t *device )
for (i = 0; i < (1 << DASD_PARTN_BITS); i++) {
destroy_buffers(MKDEV(major,minor+i));
device->major_info->gendisk.sizes[minor + i] = 0;
hardsect_size[major][minor + i] = 0;
blksize_size[major][minor + i] = 0;
}
if (device->request_queue) {
......
......@@ -190,7 +190,6 @@ MODULE_PARM_DESC(sizes, "list of device (partition) sizes " \
Xpram_Dev *xpram_devices = NULL;
int *xpram_blksizes = NULL;
int *xpram_hardsects = NULL;
int *xpram_offsets = NULL; /* partition offsets */
#define MIN(x,y) ((x) < (y) ? (x) : (y))
......@@ -1022,6 +1021,7 @@ int xpram_init(void)
#elif (XPRAM_VERSION == 24)
q = BLK_DEFAULT_QUEUE (major);
blk_init_queue (q, xpram_request);
blk_queue_hardsect_size(q, xpram_hardsect);
#endif /* V22/V24 */
/* we want to have XPRAM_UNUSED blocks security buffer between devices */
......@@ -1072,16 +1072,6 @@ int xpram_init(void)
xpram_blksizes[i] = xpram_blksize;
blksize_size[major]=xpram_blksizes;
xpram_hardsects = kmalloc(xpram_devs * sizeof(int), GFP_KERNEL);
if (!xpram_hardsects) {
PRINT_ERR("Not enough memory for xpram_hardsects\n");
PRINT_ERR("Giving up xpram\n");
goto fail_malloc_hardsects;
}
for (i=0; i < xpram_devs; i++) /* all the same hardsect */
xpram_hardsects[i] = xpram_hardsect;
hardsect_size[major]=xpram_hardsects;
/*
* allocate the devices -- we can't have them static, as the number
* can be specified at load time
......@@ -1154,12 +1144,9 @@ int xpram_init(void)
#endif /* V24 */
fail_malloc_blksizes:
kfree (xpram_offsets);
fail_malloc_hardsects:
kfree (xpram_blksizes);
blksize_size[major] = NULL;
fail_malloc_devices:
kfree(xpram_hardsects);
hardsect_size[major] = NULL;
fail_malloc:
#if (XPRAM_VERSION == 22)
blk_dev[major].request_fn = NULL;
......@@ -1197,7 +1184,6 @@ void cleanup_module(void)
blk_dev[major].request_fn = NULL;
#endif /* V22 */
kfree(blksize_size[major]);
kfree(hardsect_size[major]);
kfree(xpram_offsets);
blk_clear(major);
......
......@@ -1343,8 +1343,9 @@ ccw_req_t * tape34xx_bread (struct request *req,tape_info_t* ti,int tapeblock_ma
ccw_req_t *cqr;
ccw1_t *ccw;
__u8 *data;
unsigned bsize = blksize_size[tapeblock_major][ti->blk_minor];
int s2b = bsize/hardsect_size[tapeblock_major][ti->blk_minor];
kdev_t dev = mk_kdev(tapeblock_major, ti->blk_minor);
unsigned bsize = block_size(dev);
int s2b = bsize/get_hardsect_size(dev);
int realcount;
int size,bhct = 0;
struct buffer_head* bh;
......
......@@ -75,7 +75,6 @@ void
tapeblock_setup(tape_info_t* ti) {
blk_size[tapeblock_major][ti->blk_minor]=0; // this will be detected
blksize_size[tapeblock_major][ti->blk_minor]=2048; // blocks are 2k by default.
hardsect_size[tapeblock_major][ti->blk_minor]=512;
blk_init_queue (&ti->request_queue, tape_request_fn);
#ifdef CONFIG_DEVFS_FS
tapeblock_mkdevfstree(ti);
......@@ -106,8 +105,6 @@ tapeblock_init(void) {
memset(blk_size[tapeblock_major],0,256*sizeof(int));
blksize_size[tapeblock_major] = (int*) kmalloc (256*sizeof(int),GFP_ATOMIC);
memset(blksize_size[tapeblock_major],0,256*sizeof(int));
hardsect_size[tapeblock_major] = (int*) kmalloc (256*sizeof(int),GFP_ATOMIC);
memset(hardsect_size[tapeblock_major],0,256*sizeof(int));
max_sectors[tapeblock_major] = (int*) kmalloc (256*sizeof(int),GFP_ATOMIC);
memset(max_sectors[tapeblock_major],0,256*sizeof(int));
blkfront = kmalloc(sizeof(tape_frontend_t),GFP_KERNEL);
......
......@@ -125,11 +125,7 @@ ibm_partition(struct gendisk *hd, struct block_device *bdev,
return 0;
if (ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo);
return 0;
blocksize = hardsect_size[major(dev)][minor(dev)];
if ( blocksize <= 0 ) {
return 0;
}
blocksize >>= 9;
blocksize = get_hardsect_size(dev) >> 9;
data = read_dev_sector(bdev, inode->label_block*blocksize, &sect);
if (!data)
......
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