Commit e1b24127 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Linus Torvalds

[PATCH] s390 dasd driver update

Get rid of name and bdev in dasd_device_t structure.
parent 2d0dbb4b
......@@ -236,7 +236,7 @@ dasd_alloc_device(dasd_devmap_t *devmap)
}
/* Allocate gendisk structure for device. */
gdp = dasd_gendisk_alloc(device->name, devmap->devindex);
gdp = dasd_gendisk_alloc(devmap->devindex);
if (IS_ERR(gdp)) {
free_page((unsigned long) device->erp_mem);
free_pages((unsigned long) device->ccw_mem, 1);
......@@ -294,10 +294,6 @@ dasd_state_new_to_known(dasd_device_t *device)
return -ENODEV;
minor = devmap->devindex % DASD_PER_MAJOR;
/* Set bdev and the device name. */
device->bdev = bdget(MKDEV(major, minor << DASD_PARTN_BITS));
strcpy(device->name, device->gdp->disk_name);
/* Find a discipline for the device. */
rc = dasd_find_disc(device);
if (rc)
......@@ -341,8 +337,8 @@ dasd_state_known_to_new(dasd_device_t * device)
device->state = DASD_STATE_NEW;
/* Forget the block device */
bdev = device->bdev;
device->bdev = NULL;
bdev = bdget(MKDEV(device->gdp->major, device->gdp->first_minor));
bdput(bdev);
bdput(bdev);
}
......@@ -355,7 +351,7 @@ dasd_state_known_to_basic(dasd_device_t * device)
int rc;
/* register 'device' debug area, used for all DBF_DEV_XXX calls */
device->debug_area = debug_register(device->name, 0, 2,
device->debug_area = debug_register(device->gdp->disk_name, 0, 2,
8 * sizeof (long));
debug_register_view(device->debug_area, &debug_sprintf_view);
debug_set_level(device->debug_area, DBF_ERR);
......@@ -436,7 +432,7 @@ dasd_state_accept_to_basic(dasd_device_t * device)
static inline kdev_t
dasd_partition_to_kdev_t(dasd_device_t *device, unsigned int partition)
{
return to_kdev_t(device->bdev->bd_dev+partition);
return mk_kdev(device->gdp->major, device->gdp->first_minor+partition);
}
......@@ -453,6 +449,7 @@ dasd_state_accept_to_ready(dasd_device_t * device)
if (devmap->features & DASD_FEATURE_READONLY) {
for (i = 0; i < (1 << DASD_PARTN_BITS); i++)
set_device_ro(dasd_partition_to_kdev_t(device, i), 1);
device->ro_flag = 1;
DEV_MESSAGE (KERN_WARNING, device, "%s",
"setting read-only mode ");
}
......@@ -1582,17 +1579,12 @@ dasd_end_request_cb(dasd_ccw_req_t * cqr, void *data)
static inline void
__dasd_process_blk_queue(dasd_device_t * device)
{
struct block_device *bdev;
request_queue_t *queue;
struct list_head *l;
struct request *req;
dasd_ccw_req_t *cqr;
int nr_queued;
/* No bdev, no queue. */
bdev = device->bdev;
if (!bdev)
return;
queue = device->request_queue;
/* No queue ? Then there is nothing to do. */
if (queue == NULL)
......@@ -1619,7 +1611,7 @@ __dasd_process_blk_queue(dasd_device_t * device)
!blk_queue_empty(queue) &&
nr_queued < DASD_CHANQ_MAX_SIZE) {
req = elv_next_request(queue);
if (bdev_read_only(bdev) && rq_data_dir(req) == WRITE) {
if (device->ro_flag && rq_data_dir(req) == WRITE) {
DBF_EVENT(DBF_ERR,
"(%04x) Rejecting write request %p",
device->devinfo.devno, req);
......
......@@ -162,7 +162,7 @@ dasd_device_name(char *str, int index, int partition)
* Allocate gendisk structure for devindex.
*/
struct gendisk *
dasd_gendisk_alloc(char *device_name, int devindex)
dasd_gendisk_alloc(int devindex)
{
struct list_head *l;
struct major_info *mi;
......@@ -195,7 +195,7 @@ dasd_gendisk_alloc(char *device_name, int devindex)
return ERR_PTR(-ENOMEM);
/* Initialize gendisk structure. */
memcpy(gdp->disk_name, device_name, 16); /* huh? -- AV */
memset(gdp, 0, sizeof(struct gendisk));
gdp->major = mi->major;
gdp->first_minor = index << DASD_PARTN_BITS;
gdp->minor_shift = DASD_PARTN_BITS;
......@@ -207,15 +207,16 @@ dasd_gendisk_alloc(char *device_name, int devindex)
* dasdaa - dasdzz : 676 devices, added up = 702
* dasdaaa - dasdzzz : 17576 devices, added up = 18278
*/
len = sprintf(device_name, "dasd");
len = sprintf(gdp->disk_name, "dasd");
if (devindex > 25) {
if (devindex > 701)
len += sprintf(device_name + len, "%c",
len += sprintf(gdp->disk_name + len, "%c",
'a' + (((devindex - 702) / 676) % 26));
len += sprintf(device_name + len, "%c",
len += sprintf(gdp->disk_name + len, "%c",
'a' + (((devindex - 26) / 26) % 26));
}
len += sprintf(device_name + len, "%c", 'a' + (devindex % 26));
len += sprintf(gdp->disk_name + len, "%c", 'a' + (devindex % 26));
return gdp;
}
......
......@@ -140,7 +140,7 @@ do { \
#define DEV_MESSAGE(d_loglevel,d_device,d_string,d_args...)\
do { \
printk(d_loglevel PRINTK_HEADER " %s,%04x@%02x: " \
d_string "\n", bdevname(d_device->bdev), \
d_string "\n", d_device->gdp->disk_name, \
d_device->devinfo.devno, d_device->devinfo.irq, \
d_args); \
DBF_DEV_EVENT(DBF_ALERT, d_device, d_string, d_args); \
......@@ -258,8 +258,6 @@ typedef struct dasd_discipline_t {
typedef struct dasd_device_t {
/* Block device stuff. */
char name[16]; /* The device name in /dev. */
struct block_device *bdev;
struct gendisk *gdp;
devfs_handle_t devfs_entry;
request_queue_t *request_queue;
......@@ -267,6 +265,7 @@ typedef struct dasd_device_t {
unsigned long blocks; /* size of volume in blocks */
unsigned int bp_block; /* bytes per block */
unsigned int s2b_shift; /* log2 (bp_block/512) */
int ro_flag; /* read-only flag */
/* Device discipline stuff. */
dasd_discipline_t *discipline;
......@@ -479,7 +478,7 @@ int dasd_gendisk_init(void);
void dasd_gendisk_exit(void);
int dasd_gendisk_major_index(int);
int dasd_gendisk_index_major(int);
struct gendisk *dasd_gendisk_alloc(char *, int);
struct gendisk *dasd_gendisk_alloc(int);
void dasd_setup_partitions(dasd_device_t *);
void dasd_destroy_partitions(dasd_device_t *);
......
......@@ -464,6 +464,7 @@ dasd_ioctl_set_ro(struct block_device *bdev, int no, long args)
devmap->features &= ~DASD_FEATURE_READONLY;
for (i = 0; i < (1 << DASD_PARTN_BITS); i++)
set_device_ro(to_kdev_t(bdev->bd_dev + i), intval);
device->ro_flag = intval;
dasd_put_device(devmap);
return 0;
}
......
......@@ -154,7 +154,6 @@ dasd_devices_print(dasd_devmap_t *devmap, char *str)
{
dasd_device_t *device;
char *substr;
int major, minor;
int len;
device = dasd_get_device(devmap);
......@@ -168,11 +167,10 @@ dasd_devices_print(dasd_devmap_t *devmap, char *str)
else
len += sprintf(str + len, "(none)");
/* Print kdev. */
major = MAJOR(device->bdev->bd_dev);
minor = MINOR(device->bdev->bd_dev);
len += sprintf(str + len, " at (%3d:%3d)", major, minor);
len += sprintf(str + len, " at (%3d:%3d)",
device->gdp->major, device->gdp->first_minor);
/* Print device name. */
len += sprintf(str + len, " is %-7s", device->name);
len += sprintf(str + len, " is %-7s", device->gdp->disk_name);
/* Print devices features. */
substr = (devmap->features & DASD_FEATURE_READONLY) ? "(ro)" : " ";
len += sprintf(str + len, "%4s: ", substr);
......
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