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

[PATCH] 2.5.22: dasd patches.

1) Replace is_read_only with bdev_read_only. The last user of is_read_only
   is gone...
2) Remove alloc & free of the label array in dasd_genhd. This is needed for
   the label array extension but this is a patch of its own.
3) Maintain the old behaviour of /proc/dasd/devices. Its is possible again
   to use "add <devno>" instead of "add device <devno>" or "add range=<devno>".
parent dcfdb40c
...@@ -1573,6 +1573,7 @@ dasd_end_request_cb(dasd_ccw_req_t * cqr, void *data) ...@@ -1573,6 +1573,7 @@ dasd_end_request_cb(dasd_ccw_req_t * cqr, void *data)
static inline void static inline void
__dasd_process_blk_queue(dasd_device_t * device) __dasd_process_blk_queue(dasd_device_t * device)
{ {
struct block_device *bdev;
request_queue_t *queue; request_queue_t *queue;
struct list_head *l; struct list_head *l;
struct request *req; struct request *req;
...@@ -1601,11 +1602,14 @@ __dasd_process_blk_queue(dasd_device_t * device) ...@@ -1601,11 +1602,14 @@ __dasd_process_blk_queue(dasd_device_t * device)
if (cqr->status == DASD_CQR_QUEUED) if (cqr->status == DASD_CQR_QUEUED)
nr_queued++; nr_queued++;
} }
bdev = bdget(kdev_t_to_nr(device->kdev));
if (!bdev)
return;
while (!blk_queue_plugged(queue) && while (!blk_queue_plugged(queue) &&
!blk_queue_empty(queue) && !blk_queue_empty(queue) &&
nr_queued < DASD_CHANQ_MAX_SIZE) { nr_queued < DASD_CHANQ_MAX_SIZE) {
req = elv_next_request(queue); req = elv_next_request(queue);
if (is_read_only(device->kdev) && rq_data_dir(req) == WRITE) { if (bdev_read_only(bdev) && rq_data_dir(req) == WRITE) {
DBF_EVENT(DBF_ERR, DBF_EVENT(DBF_ERR,
"(%04x) Rejecting write request %p", "(%04x) Rejecting write request %p",
device->devinfo.devno, req); device->devinfo.devno, req);
...@@ -1632,6 +1636,7 @@ __dasd_process_blk_queue(dasd_device_t * device) ...@@ -1632,6 +1636,7 @@ __dasd_process_blk_queue(dasd_device_t * device)
dasd_profile_start(device, cqr, req); dasd_profile_start(device, cqr, req);
nr_queued++; nr_queued++;
} }
bdput(bdev);
} }
/* /*
......
...@@ -65,7 +65,7 @@ dasd_register_major(int major) ...@@ -65,7 +65,7 @@ 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, *gd_label_arr; devfs_handle_t *gd_de_arr;
int *gd_sizes; int *gd_sizes;
char *gd_flags; char *gd_flags;
int new_major, rc; int new_major, rc;
...@@ -78,14 +78,12 @@ dasd_register_major(int major) ...@@ -78,14 +78,12 @@ dasd_register_major(int major)
gd_de_arr = kmalloc(DASD_PER_MAJOR * sizeof(devfs_handle_t), gd_de_arr = kmalloc(DASD_PER_MAJOR * sizeof(devfs_handle_t),
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_label_arr = kmalloc(DASD_PER_MAJOR * sizeof(devfs_handle_t),
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); 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_label_arr == NULL || gd_part == NULL || gd_sizes == NULL) { gd_part == NULL || gd_sizes == 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");
...@@ -114,14 +112,12 @@ dasd_register_major(int major) ...@@ -114,14 +112,12 @@ dasd_register_major(int major)
mi->gendisk.fops = &dasd_device_operations; mi->gendisk.fops = &dasd_device_operations;
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.label_arr = gd_label_arr;
mi->gendisk.part = gd_part; mi->gendisk.part = gd_part;
mi->gendisk.sizes = gd_sizes; 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_label_arr, 0, DASD_PER_MAJOR * sizeof(devfs_handle_t));
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); memset(gd_sizes, 0, sizeof(int) << MINORBITS);
...@@ -143,7 +139,6 @@ dasd_register_major(int major) ...@@ -143,7 +139,6 @@ dasd_register_major(int major)
/* We rely on kfree to do the != NULL check. */ /* We rely on kfree to do the != NULL check. */
kfree(gd_sizes); kfree(gd_sizes);
kfree(gd_part); kfree(gd_part);
kfree(gd_label_arr);
kfree(gd_flags); kfree(gd_flags);
kfree(gd_de_arr); kfree(gd_de_arr);
kfree(mi); kfree(mi);
...@@ -182,7 +177,6 @@ dasd_unregister_major(struct major_info * mi) ...@@ -182,7 +177,6 @@ dasd_unregister_major(struct major_info * mi)
/* Free memory. */ /* Free memory. */
kfree(bs); kfree(bs);
kfree(mi->gendisk.part); kfree(mi->gendisk.part);
kfree(mi->gendisk.label_arr);
kfree(mi->gendisk.flags); kfree(mi->gendisk.flags);
kfree(mi->gendisk.de_arr); kfree(mi->gendisk.de_arr);
kfree(mi); kfree(mi);
......
...@@ -93,7 +93,7 @@ dasd_devices_write(struct file *file, const char *user_buf, ...@@ -93,7 +93,7 @@ dasd_devices_write(struct file *file, const char *user_buf,
size_t user_len, loff_t * offset) size_t user_len, loff_t * offset)
{ {
char *buffer, *str; char *buffer, *str;
int add_or_set, device_or_range; int add_or_set;
int from, to, features; int from, to, features;
buffer = dasd_get_user_string(user_buf, user_len); buffer = dasd_get_user_string(user_buf, user_len);
...@@ -109,15 +109,11 @@ dasd_devices_write(struct file *file, const char *user_buf, ...@@ -109,15 +109,11 @@ dasd_devices_write(struct file *file, const char *user_buf,
goto out_error; goto out_error;
for (str = str + 4; isspace(*str); str++); for (str = str + 4; isspace(*str); str++);
/* Scan for "device " or "range=". */ /* Scan for "device " and "range=" and ignore it. This is sick. */
if (strncmp(str, "device", 6) == 0 && isspace(str[6])) { if (strncmp(str, "device", 6) == 0 && isspace(str[6]))
device_or_range = 0; for (str = str + 6; isspace(*str); str++);
if (strncmp(str, "range=", 6) == 0)
for (str = str + 6; isspace(*str); str++); for (str = str + 6; isspace(*str); str++);
} else if (strncmp(str, "range=", 6) == 0) {
device_or_range = 1;
str = str + 6;
} else
goto out_error;
/* Scan device number range and feature string. */ /* Scan device number range and feature string. */
to = from = dasd_devno(str, &str); to = from = dasd_devno(str, &str);
......
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