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

[PATCH] s390: dasd block device driver.

updates for s390 dasd driver

Some problems have been found in the dasd error handling code, they
are fixed by the update to dasd_3990_erp.c.

Dasd is one of only two remaining drivers that use the null
elevator instead of iosched. Appearantly, the null elevator
has some bitrot and can result in random data loss. For now,
we just don't use it.
parent 65bdce08
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Bugreports.to..: <Linux390@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
* *
* $Revision: 1.71 $ * $Revision: 1.74 $
* *
* History of changes (starts July 2000) * History of changes (starts July 2000)
* 11/09/00 complete redesign after code review * 11/09/00 complete redesign after code review
...@@ -1656,17 +1656,20 @@ dasd_setup_blkdev(dasd_device_t * device) ...@@ -1656,17 +1656,20 @@ dasd_setup_blkdev(dasd_device_t * device)
device->request_queue = kmalloc(sizeof (request_queue_t), GFP_KERNEL); device->request_queue = kmalloc(sizeof (request_queue_t), GFP_KERNEL);
if (device->request_queue == NULL) if (device->request_queue == NULL)
return -ENOMEM; return -ENOMEM;
memset(device->request_queue, 0, sizeof(request_queue_t));
device->request_queue->queuedata = device; device->request_queue->queuedata = device;
rc = blk_init_queue(device->request_queue, do_dasd_request, rc = blk_init_queue(device->request_queue, do_dasd_request,
&device->request_queue_lock); &device->request_queue_lock);
if (rc) if (rc)
return rc; return rc;
#if 0
elevator_exit(device->request_queue); elevator_exit(device->request_queue);
rc = elevator_init(device->request_queue, &elevator_noop); rc = elevator_init(device->request_queue, &elevator_noop);
if (rc) { if (rc) {
blk_cleanup_queue(device->request_queue); blk_cleanup_queue(device->request_queue);
return rc; return rc;
} }
#endif
blk_queue_hardsect_size(device->request_queue, device->bp_block); blk_queue_hardsect_size(device->request_queue, device->bp_block);
max = device->discipline->max_blocks << device->s2b_shift; max = device->discipline->max_blocks << device->s2b_shift;
blk_queue_max_sectors(device->request_queue, max); blk_queue_max_sectors(device->request_queue, max);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Bugreports.to..: <Linux390@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000, 2001 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000, 2001
* *
* $Revision: 1.19 $ * $Revision: 1.20 $
* *
* History of changes: * History of changes:
* 05/14/01 fixed PL030160GTO (BUG() in erp_action_5) * 05/14/01 fixed PL030160GTO (BUG() in erp_action_5)
...@@ -454,7 +454,7 @@ dasd_3990_erp_action_4(dasd_ccw_req_t * erp, char *sense) ...@@ -454,7 +454,7 @@ dasd_3990_erp_action_4(dasd_ccw_req_t * erp, char *sense)
} else { } else {
if (sense[25] & 0x1D) { /* state change pending */ if (sense[25] == 0x1D) { /* state change pending */
DEV_MESSAGE(KERN_INFO, device, "%s", DEV_MESSAGE(KERN_INFO, device, "%s",
"waiting for state change pending " "int"); "waiting for state change pending " "int");
...@@ -464,6 +464,10 @@ dasd_3990_erp_action_4(dasd_ccw_req_t * erp, char *sense) ...@@ -464,6 +464,10 @@ dasd_3990_erp_action_4(dasd_ccw_req_t * erp, char *sense)
} else { } else {
/* no state change pending - retry */ /* no state change pending - retry */
DEV_MESSAGE (KERN_INFO, device,
"redriving request immediately, "
"%d retries left",
erp->retries);
erp->status = DASD_CQR_QUEUED; erp->status = DASD_CQR_QUEUED;
} }
} }
...@@ -2273,21 +2277,35 @@ dasd_3990_erp_add_erp(dasd_ccw_req_t * cqr) ...@@ -2273,21 +2277,35 @@ dasd_3990_erp_add_erp(dasd_ccw_req_t * cqr)
{ {
dasd_device_t *device = cqr->device; dasd_device_t *device = cqr->device;
struct ccw1 *ccw;
/* allocate additional request block */ /* allocate additional request block */
dasd_ccw_req_t *erp; dasd_ccw_req_t *erp;
erp = dasd_alloc_erp_request((char *) &cqr->magic, 1, 0, cqr->device); erp = dasd_alloc_erp_request((char *) &cqr->magic, 2, 0, cqr->device);
if (IS_ERR(erp)) { if (IS_ERR(erp)) {
if (cqr->retries <= 0) {
DEV_MESSAGE(KERN_ERR, device, "%s", DEV_MESSAGE(KERN_ERR, device, "%s",
"Unable to allocate ERP request"); "Unable to allocate ERP request");
cqr->status = DASD_CQR_FAILED; cqr->status = DASD_CQR_FAILED;
cqr->stopclk = get_clock ();
} else {
DEV_MESSAGE (KERN_ERR, device,
"Unable to allocate ERP request "
"(%i retries left)",
cqr->retries);
dasd_set_timer(device, (HZ << 3));
}
return cqr; return cqr;
} }
/* initialize request with default TIC to current ERP/CQR */ /* initialize request with default TIC to current ERP/CQR */
erp->cpaddr->cmd_code = CCW_CMD_TIC; ccw = erp->cpaddr;
erp->cpaddr->cda = (long) (cqr->cpaddr); ccw->cmd_code = CCW_CMD_NOOP;
ccw->flags = CCW_FLAG_CC;
ccw++;
ccw->cmd_code = CCW_CMD_TIC;
ccw->cda = (long)(cqr->cpaddr);
erp->function = dasd_3990_erp_add_erp; erp->function = dasd_3990_erp_add_erp;
erp->refers = cqr; erp->refers = cqr;
erp->device = cqr->device; erp->device = cqr->device;
...@@ -2362,7 +2380,7 @@ dasd_3990_erp_error_match(dasd_ccw_req_t * cqr1, dasd_ccw_req_t * cqr2) ...@@ -2362,7 +2380,7 @@ dasd_3990_erp_error_match(dasd_ccw_req_t * cqr1, dasd_ccw_req_t * cqr2)
} }
/* check sense data; byte 0-2,25,27 */ /* check sense data; byte 0-2,25,27 */
if (!((strncmp(cqr1->dstat->ecw, cqr2->dstat->ecw, 3) == 0) && if (!((memcmp (cqr1->dstat->ecw, cqr2->dstat->ecw, 3) == 0) &&
(cqr1->dstat->ecw[27] == cqr2->dstat->ecw[27]) && (cqr1->dstat->ecw[27] == cqr2->dstat->ecw[27]) &&
(cqr1->dstat->ecw[25] == cqr2->dstat->ecw[25]))) { (cqr1->dstat->ecw[25] == cqr2->dstat->ecw[25]))) {
...@@ -2549,7 +2567,7 @@ dasd_3990_erp_handle_match_erp(dasd_ccw_req_t * erp_head, dasd_ccw_req_t * erp) ...@@ -2549,7 +2567,7 @@ dasd_3990_erp_handle_match_erp(dasd_ccw_req_t * erp_head, dasd_ccw_req_t * erp)
if (erp->retries > 0) { if (erp->retries > 0) {
char *sense = erp->dstat->ecw; char *sense = erp->refers->dstat->ecw;
/* check for special retries */ /* check for special retries */
if (erp->function == dasd_3990_erp_action_4) { if (erp->function == dasd_3990_erp_action_4) {
...@@ -2680,35 +2698,9 @@ dasd_3990_erp_action(dasd_ccw_req_t * cqr) ...@@ -2680,35 +2698,9 @@ dasd_3990_erp_action(dasd_ccw_req_t * cqr)
dasd_log_ccw(erp, 1, cpa); dasd_log_ccw(erp, 1, cpa);
/* enqueue added ERP request */ /* enqueue added ERP request */
if ((erp != cqr) && (erp->status == DASD_CQR_FILLED)) { if (erp->status == DASD_CQR_FILLED) {
erp->status = DASD_CQR_QUEUED; erp->status = DASD_CQR_QUEUED;
list_add(&erp->list, &device->ccw_queue); list_add(&erp->list, &device->ccw_queue);
} else {
if ((erp->status == DASD_CQR_FILLED) || (erp != cqr)) {
/* something strange happened - log the error and throw a BUG() */
DEV_MESSAGE(KERN_ERR, device, "%s",
"Problems with ERP chain!!! BUG");
/* print current erp_chain */
DEV_MESSAGE(KERN_DEBUG, device, "%s",
"ERP chain at END of ERP-ACTION");
{
dasd_ccw_req_t *temp_erp = NULL;
for (temp_erp = erp;
temp_erp != NULL;
temp_erp = temp_erp->refers) {
DEV_MESSAGE(KERN_DEBUG, device,
" erp %p (function %p)"
" refers to %p",
temp_erp,
temp_erp->function,
temp_erp->refers);
}
}
BUG();
}
} }
return erp; return erp;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Bugreports.to..: <Linux390@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com>
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
* *
* $Revision: 1.35 $ * $Revision: 1.36 $
* *
* History of changes (starts July 2000) * History of changes (starts July 2000)
* 07/11/00 Enabled rotational position sensing * 07/11/00 Enabled rotational position sensing
......
...@@ -111,7 +111,7 @@ dasd_ioctl(struct inode *inp, struct file *filp, ...@@ -111,7 +111,7 @@ dasd_ioctl(struct inode *inp, struct file *filp,
ioctl = list_entry(l, dasd_ioctl_list_t, list); ioctl = list_entry(l, dasd_ioctl_list_t, list);
if (ioctl->no == no) { if (ioctl->no == no) {
/* Found a matching ioctl. Call it. */ /* Found a matching ioctl. Call it. */
if (try_module_get(ioctl->owner) != 0) if (!try_module_get(ioctl->owner))
continue; continue;
rc = ioctl->handler(bdev, no, data); rc = ioctl->handler(bdev, no, data);
module_put(ioctl->owner); module_put(ioctl->owner);
...@@ -263,7 +263,7 @@ dasd_ioctl_reset_profile(struct block_device *bdev, int no, long args) ...@@ -263,7 +263,7 @@ dasd_ioctl_reset_profile(struct block_device *bdev, int no, long args)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
device = = bdev->bd_disk->private_data; device = bdev->bd_disk->private_data;
if (device == NULL) if (device == NULL)
return -ENODEV; return -ENODEV;
...@@ -279,7 +279,7 @@ dasd_ioctl_read_profile(struct block_device *bdev, int no, long args) ...@@ -279,7 +279,7 @@ dasd_ioctl_read_profile(struct block_device *bdev, int no, long args)
{ {
dasd_device_t *device; dasd_device_t *device;
device = = bdev->bd_disk->private_data; device = bdev->bd_disk->private_data;
if (device == NULL) if (device == NULL)
return -ENODEV; return -ENODEV;
......
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