From: Bart Van Assche <bart.vanassche@wdc.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bart.vanassche@wdc.com>,
Hannes Reinecke <hare@suse.de>,
Johannes Thumshirn <jthumshirn@suse.de>
Subject: [PATCH 2/4] skd: Inline skd_end_request()
Date: Fri, 25 Aug 2017 14:24:12 -0700 [thread overview]
Message-ID: <20170825212414.28322-3-bart.vanassche@wdc.com> (raw)
In-Reply-To: <20170825212414.28322-1-bart.vanassche@wdc.com>
It is not worth to keep the debug statements in skd_end_request().
Without debug statements that function only consists of two
statements. Hence inline skd_end_request().
Suggested-by: Christoph Hellwig <hch@lst.de>
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>
---
drivers/block/skd_main.c | 45 +++++++++++++--------------------------------
1 file changed, 13 insertions(+), 32 deletions(-)
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index a55c8ef1a21d..8ae0320f02b5 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -360,8 +360,6 @@ static void skd_send_fitmsg(struct skd_device *skdev,
struct skd_fitmsg_context *skmsg);
static void skd_send_special_fitmsg(struct skd_device *skdev,
struct skd_special_context *skspcl);
-static void skd_end_request(struct skd_device *skdev, struct request *req,
- blk_status_t status);
static bool skd_preop_sg_list(struct skd_device *skdev,
struct skd_request_context *skreq);
static void skd_postop_sg_list(struct skd_device *skdev,
@@ -520,8 +518,8 @@ static blk_status_t skd_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
if (req->bio && !skd_preop_sg_list(skdev, skreq)) {
dev_dbg(&skdev->pdev->dev, "error Out\n");
- skd_end_request(skdev, blk_mq_rq_from_pdu(skreq),
- BLK_STS_RESOURCE);
+ skreq->status = BLK_STS_RESOURCE;
+ blk_mq_complete_request(req);
return BLK_STS_OK;
}
@@ -608,27 +606,6 @@ static enum blk_eh_timer_return skd_timed_out(struct request *req,
return BLK_EH_RESET_TIMER;
}
-static void skd_end_request(struct skd_device *skdev, struct request *req,
- blk_status_t error)
-{
- struct skd_request_context *skreq = blk_mq_rq_to_pdu(req);
-
- if (unlikely(error)) {
- char *cmd = (rq_data_dir(req) == READ) ? "read" : "write";
- u32 lba = (u32)blk_rq_pos(req);
- u32 count = blk_rq_sectors(req);
-
- dev_err(&skdev->pdev->dev,
- "Error cmd=%s sect=%u count=%u id=0x%x\n", cmd, lba,
- count, req->tag);
- } else
- dev_dbg(&skdev->pdev->dev, "id=0x%x error=%d\n", req->tag,
- error);
-
- skreq->status = error;
- blk_mq_complete_request(req);
-}
-
static void skd_complete_rq(struct request *req)
{
struct skd_request_context *skreq = blk_mq_rq_to_pdu(req);
@@ -1438,7 +1415,8 @@ static void skd_resolve_req_exception(struct skd_device *skdev,
switch (skd_check_status(skdev, cmp_status, &skreq->err_info)) {
case SKD_CHECK_STATUS_REPORT_GOOD:
case SKD_CHECK_STATUS_REPORT_SMART_ALERT:
- skd_end_request(skdev, req, BLK_STS_OK);
+ skreq->status = BLK_STS_OK;
+ blk_mq_complete_request(req);
break;
case SKD_CHECK_STATUS_BUSY_IMMINENT:
@@ -1460,7 +1438,8 @@ static void skd_resolve_req_exception(struct skd_device *skdev,
case SKD_CHECK_STATUS_REPORT_ERROR:
default:
- skd_end_request(skdev, req, BLK_STS_IOERR);
+ skreq->status = BLK_STS_IOERR;
+ blk_mq_complete_request(req);
break;
}
}
@@ -1579,10 +1558,12 @@ static int skd_isr_completion_posted(struct skd_device *skdev,
/*
* Capture the outcome and post it back to the native request.
*/
- if (likely(cmp_status == SAM_STAT_GOOD))
- skd_end_request(skdev, rq, BLK_STS_OK);
- else
+ if (likely(cmp_status == SAM_STAT_GOOD)) {
+ skreq->status = BLK_STS_OK;
+ blk_mq_complete_request(rq);
+ } else {
skd_resolve_req_exception(skdev, skreq, rq);
+ }
/* skd_isr_comp_limit equal zero means no limit */
if (limit) {
@@ -1926,8 +1907,8 @@ static void skd_recover_request(struct request *req, void *data, bool reserved)
skd_postop_sg_list(skdev, skreq);
skreq->state = SKD_REQ_STATE_IDLE;
-
- skd_end_request(skdev, req, BLK_STS_IOERR);
+ skreq->status = BLK_STS_IOERR;
+ blk_mq_complete_request(req);
}
static void skd_recover_requests(struct skd_device *skdev)
--
2.14.1
next prev parent reply other threads:[~2017-08-25 21:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-25 21:24 [PATCH 0/4] Four more patches for the sTec s1120 driver (skd) Bart Van Assche
2017-08-25 21:24 ` [PATCH 1/4] skd: Rename skd_softirq_done() into skd_complete_rq() Bart Van Assche
2017-08-25 21:24 ` Bart Van Assche [this message]
2017-08-25 21:24 ` [PATCH 3/4] skd: Make it easier for static analyzers to analyze skd_free_disk() Bart Van Assche
2017-08-26 6:01 ` Dan Carpenter
2017-08-25 21:24 ` [PATCH 4/4] skd: Remove SKD_ID_INCR Bart Van Assche
2017-08-25 21:30 ` [PATCH 0/4] Four more patches for the sTec s1120 driver (skd) Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170825212414.28322-3-bart.vanassche@wdc.com \
--to=bart.vanassche@wdc.com \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jthumshirn@suse.de \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox