summaryrefslogtreecommitdiffstats
path: root/drivers/block/skd_main.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2017-08-17 22:13:29 +0200
committerJens Axboe <axboe@kernel.dk>2017-08-18 16:45:29 +0200
commit4e54b8492796fc9104141e60d0ed658df07bd518 (patch)
treefcae401d1050eaafb1f0fd9a840a48470433f7c7 /drivers/block/skd_main.c
parentskd: Introduce skd_process_request() (diff)
downloadlinux-4e54b8492796fc9104141e60d0ed658df07bd518.tar.xz
linux-4e54b8492796fc9104141e60d0ed658df07bd518.zip
skd: Split skd_recover_requests()
This patch does not change any functionality but makes the blk-mq conversion patch easier to read. 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/block/skd_main.c')
-rw-r--r--drivers/block/skd_main.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 1d10373b0da3..451974138b32 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -2031,31 +2031,36 @@ static void skd_isr_fwstate(struct skd_device *skdev)
skd_skdev_state_to_str(skdev->state), skdev->state);
}
-static void skd_recover_requests(struct skd_device *skdev)
+static void skd_recover_request(struct skd_device *skdev,
+ struct skd_request_context *skreq)
{
- int i;
+ struct request *req = skreq->req;
- for (i = 0; i < skdev->num_req_context; i++) {
- struct skd_request_context *skreq = &skdev->skreq_table[i];
- struct request *req = skreq->req;
+ if (skreq->state != SKD_REQ_STATE_BUSY)
+ return;
+
+ skd_log_skreq(skdev, skreq, "recover");
+
+ SKD_ASSERT(req != NULL);
- if (skreq->state == SKD_REQ_STATE_BUSY) {
- skd_log_skreq(skdev, skreq, "recover");
+ /* Release DMA resources for the request. */
+ if (skreq->n_sg > 0)
+ skd_postop_sg_list(skdev, skreq);
- SKD_ASSERT((skreq->id & SKD_ID_INCR) != 0);
- SKD_ASSERT(req != NULL);
+ skreq->req = NULL;
+ skreq->state = SKD_REQ_STATE_IDLE;
- /* Release DMA resources for the request. */
- if (skreq->n_sg > 0)
- skd_postop_sg_list(skdev, skreq);
+ skd_end_request(skdev, req, BLK_STS_IOERR);
+}
- skreq->req = NULL;
+static void skd_recover_requests(struct skd_device *skdev)
+{
+ int i;
- skreq->state = SKD_REQ_STATE_IDLE;
- skreq->id += SKD_ID_INCR;
+ for (i = 0; i < skdev->num_req_context; i++) {
+ struct skd_request_context *skreq = &skdev->skreq_table[i];
- skd_end_request(skdev, req, BLK_STS_IOERR);
- }
+ skd_recover_request(skdev, skreq);
}
for (i = 0; i < SKD_N_TIMEOUT_SLOT; i++)