diff options
author | Bart Van Assche <bart.vanassche@wdc.com> | 2017-08-17 13:13:21 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-08-18 08:45:29 -0600 |
commit | 3d17a679d3514c6727dcf2a9d9f45c709da5352e (patch) | |
tree | 4f0ea8f36d4cd9af87c6010a15b5587961b61939 /drivers | |
parent | cb6981b9a3de38cb2b49eabcec44a1e55056b411 (diff) | |
download | linux-stable-3d17a679d3514c6727dcf2a9d9f45c709da5352e.tar.gz linux-stable-3d17a679d3514c6727dcf2a9d9f45c709da5352e.tar.bz2 linux-stable-3d17a679d3514c6727dcf2a9d9f45c709da5352e.zip |
skd: Rework request failing code path
Move the skd_fail_all_pending() call out of skd_request_fn_not_online()
such that this function can be reused in the blk-mq code path.
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/skd_main.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c index ff2ea37b8fd3..8040500ba09c 100644 --- a/drivers/block/skd_main.c +++ b/drivers/block/skd_main.c @@ -506,7 +506,10 @@ skd_prep_zerosize_flush_cdb(struct skd_scsi_request *scsi_req, scsi_req->cdb[9] = 0; } -static void skd_request_fn_not_online(struct request_queue *q) +/* + * Return true if and only if all pending requests should be failed. + */ +static bool skd_fail_all(struct request_queue *q) { struct skd_device *skdev = q->queuedata; @@ -530,7 +533,7 @@ static void skd_request_fn_not_online(struct request_queue *q) case SKD_DRVR_STATE_BUSY_IMMINENT: case SKD_DRVR_STATE_BUSY_ERASE: case SKD_DRVR_STATE_DRAINING_TIMEOUT: - return; + return false; case SKD_DRVR_STATE_BUSY_SANITIZE: case SKD_DRVR_STATE_STOPPING: @@ -538,14 +541,8 @@ static void skd_request_fn_not_online(struct request_queue *q) case SKD_DRVR_STATE_FAULT: case SKD_DRVR_STATE_DISAPPEARED: default: - break; + return true; } - - /* If we get here, terminate all pending block requeusts - * with EIO and any scsi pass thru with appropriate sense - */ - - skd_fail_all_pending(skdev); } static void skd_request_fn(struct request_queue *q) @@ -566,7 +563,8 @@ static void skd_request_fn(struct request_queue *q) int flush, fua; if (skdev->state != SKD_DRVR_STATE_ONLINE) { - skd_request_fn_not_online(q); + if (skd_fail_all(q)) + skd_fail_all_pending(skdev); return; } |