Commit 1c01b8a5 authored by Horst Hummel's avatar Horst Hummel Committed by Linus Torvalds

[PATCH] s390: dasd failfast support

To properly support multipath-failover handling, the linux block layer has
introduced a special request flag, 'REQ_FAILFAST'.  This flag is now used to
return requests immediately in case the device is not operational.
Signed-off-by: default avatarHorst Hummel <horst.hummel@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9a7af289
...@@ -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.169 $ * $Revision: 1.172 $
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -1224,6 +1224,12 @@ __dasd_start_head(struct dasd_device * device) ...@@ -1224,6 +1224,12 @@ __dasd_start_head(struct dasd_device * device)
if (list_empty(&device->ccw_queue)) if (list_empty(&device->ccw_queue))
return; return;
cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list);
/* check FAILFAST */
if (device->stopped & ~DASD_STOPPED_PENDING &&
test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags)) {
cqr->status = DASD_CQR_FAILED;
dasd_schedule_bh(device);
}
if ((cqr->status == DASD_CQR_QUEUED) && if ((cqr->status == DASD_CQR_QUEUED) &&
(!device->stopped)) { (!device->stopped)) {
/* try to start the first I/O that can be started */ /* try to start the first I/O that can be started */
...@@ -1750,8 +1756,10 @@ dasd_exit(void) ...@@ -1750,8 +1756,10 @@ dasd_exit(void)
* SECTION: common functions for ccw_driver use * SECTION: common functions for ccw_driver use
*/ */
/* initial attempt at a probe function. this can be simplified once /*
* the other detection code is gone */ * Initial attempt at a probe function. this can be simplified once
* the other detection code is gone.
*/
int int
dasd_generic_probe (struct ccw_device *cdev, dasd_generic_probe (struct ccw_device *cdev,
struct dasd_discipline *discipline) struct dasd_discipline *discipline)
...@@ -1770,8 +1778,10 @@ dasd_generic_probe (struct ccw_device *cdev, ...@@ -1770,8 +1778,10 @@ dasd_generic_probe (struct ccw_device *cdev,
return ret; return ret;
} }
/* this will one day be called from a global not_oper handler. /*
* It is also used by driver_unregister during module unload */ * This will one day be called from a global not_oper handler.
* It is also used by driver_unregister during module unload.
*/
void void
dasd_generic_remove (struct ccw_device *cdev) dasd_generic_remove (struct ccw_device *cdev)
{ {
...@@ -1798,9 +1808,11 @@ dasd_generic_remove (struct ccw_device *cdev) ...@@ -1798,9 +1808,11 @@ dasd_generic_remove (struct ccw_device *cdev)
dasd_delete_device(device); dasd_delete_device(device);
} }
/* activate a device. This is called from dasd_{eckd,fba}_probe() when either /*
* Activate a device. This is called from dasd_{eckd,fba}_probe() when either
* the device is detected for the first time and is supposed to be used * the device is detected for the first time and is supposed to be used
* or the user has started activation through sysfs */ * or the user has started activation through sysfs.
*/
int int
dasd_generic_set_online (struct ccw_device *cdev, dasd_generic_set_online (struct ccw_device *cdev,
struct dasd_discipline *discipline) struct dasd_discipline *discipline)
...@@ -1917,7 +1929,6 @@ dasd_generic_notify(struct ccw_device *cdev, int event) ...@@ -1917,7 +1929,6 @@ dasd_generic_notify(struct ccw_device *cdev, int event)
if (cqr->status == DASD_CQR_IN_IO) if (cqr->status == DASD_CQR_IN_IO)
cqr->status = DASD_CQR_FAILED; cqr->status = DASD_CQR_FAILED;
device->stopped |= DASD_STOPPED_DC_EIO; device->stopped |= DASD_STOPPED_DC_EIO;
dasd_schedule_bh(device);
} else { } else {
list_for_each_entry(cqr, &device->ccw_queue, list) list_for_each_entry(cqr, &device->ccw_queue, list)
if (cqr->status == DASD_CQR_IN_IO) { if (cqr->status == DASD_CQR_IN_IO) {
...@@ -1927,6 +1938,7 @@ dasd_generic_notify(struct ccw_device *cdev, int event) ...@@ -1927,6 +1938,7 @@ dasd_generic_notify(struct ccw_device *cdev, int event)
device->stopped |= DASD_STOPPED_DC_WAIT; device->stopped |= DASD_STOPPED_DC_WAIT;
dasd_set_timer(device, 0); dasd_set_timer(device, 0);
} }
dasd_schedule_bh(device);
ret = 1; ret = 1;
break; break;
case CIO_OPER: case CIO_OPER:
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,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.52 $ * $Revision: 1.53 $
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -549,6 +549,8 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req) ...@@ -549,6 +549,8 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req)
} }
cqr->retries = DIAG_MAX_RETRIES; cqr->retries = DIAG_MAX_RETRIES;
cqr->buildclk = get_clock(); cqr->buildclk = get_clock();
if (req->flags & REQ_FAILFAST)
set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
cqr->device = device; cqr->device = device;
cqr->expires = DIAG_TIMEOUT; cqr->expires = DIAG_TIMEOUT;
cqr->status = DASD_CQR_FILLED; cqr->status = DASD_CQR_FILLED;
......
...@@ -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.71 $ * $Revision: 1.74 $
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -1136,6 +1136,8 @@ dasd_eckd_build_cp(struct dasd_device * device, struct request *req) ...@@ -1136,6 +1136,8 @@ dasd_eckd_build_cp(struct dasd_device * device, struct request *req)
recid++; recid++;
} }
} }
if (req->flags & REQ_FAILFAST)
set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
cqr->device = device; cqr->device = device;
cqr->expires = 5 * 60 * HZ; /* 5 minutes */ cqr->expires = 5 * 60 * HZ; /* 5 minutes */
cqr->lpm = private->path_data.ppm; cqr->lpm = private->path_data.ppm;
...@@ -1252,6 +1254,7 @@ dasd_eckd_release(struct block_device *bdev, int no, long args) ...@@ -1252,6 +1254,7 @@ dasd_eckd_release(struct block_device *bdev, int no, long args)
cqr->cpaddr->cda = (__u32)(addr_t) cqr->data; cqr->cpaddr->cda = (__u32)(addr_t) cqr->data;
cqr->device = device; cqr->device = device;
clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
cqr->retries = 0; cqr->retries = 0;
cqr->expires = 2 * HZ; cqr->expires = 2 * HZ;
cqr->buildclk = get_clock(); cqr->buildclk = get_clock();
...@@ -1296,6 +1299,7 @@ dasd_eckd_reserve(struct block_device *bdev, int no, long args) ...@@ -1296,6 +1299,7 @@ dasd_eckd_reserve(struct block_device *bdev, int no, long args)
cqr->cpaddr->cda = (__u32)(addr_t) cqr->data; cqr->cpaddr->cda = (__u32)(addr_t) cqr->data;
cqr->device = device; cqr->device = device;
clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
cqr->retries = 0; cqr->retries = 0;
cqr->expires = 2 * HZ; cqr->expires = 2 * HZ;
cqr->buildclk = get_clock(); cqr->buildclk = get_clock();
...@@ -1339,6 +1343,7 @@ dasd_eckd_steal_lock(struct block_device *bdev, int no, long args) ...@@ -1339,6 +1343,7 @@ dasd_eckd_steal_lock(struct block_device *bdev, int no, long args)
cqr->cpaddr->cda = (__u32)(addr_t) cqr->data; cqr->cpaddr->cda = (__u32)(addr_t) cqr->data;
cqr->device = device; cqr->device = device;
clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
cqr->retries = 0; cqr->retries = 0;
cqr->expires = 2 * HZ; cqr->expires = 2 * HZ;
cqr->buildclk = get_clock(); cqr->buildclk = get_clock();
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,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.40 $ * $Revision: 1.41 $
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -352,6 +352,8 @@ dasd_fba_build_cp(struct dasd_device * device, struct request *req) ...@@ -352,6 +352,8 @@ dasd_fba_build_cp(struct dasd_device * device, struct request *req)
recid++; recid++;
} }
} }
if (req->flags & REQ_FAILFAST)
set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
cqr->device = device; cqr->device = device;
cqr->expires = 5 * 60 * HZ; /* 5 minutes */ cqr->expires = 5 * 60 * HZ; /* 5 minutes */
cqr->retries = 32; cqr->retries = 32;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,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.65 $ * $Revision: 1.68 $
*/ */
#ifndef DASD_INT_H #ifndef DASD_INT_H
...@@ -208,6 +208,7 @@ struct dasd_ccw_req { ...@@ -208,6 +208,7 @@ struct dasd_ccw_req {
/* per dasd_ccw_req flags */ /* per dasd_ccw_req flags */
#define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request */ #define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request */
#define DASD_CQR_FLAGS_FAILFAST 1 /* FAILFAST */
/* Signature for error recovery functions. */ /* Signature for error recovery functions. */
typedef struct dasd_ccw_req *(*dasd_erp_fn_t) (struct dasd_ccw_req *); typedef struct dasd_ccw_req *(*dasd_erp_fn_t) (struct dasd_ccw_req *);
......
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