summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>2019-08-22 21:45:19 -0700
committerJens Axboe <axboe@kernel.dk>2019-08-23 06:58:05 -0600
commita3d7d67403fcff366dafe8a7c04b15deec3d9022 (patch)
tree5dc4ef1677eb293868324f23e516160cbadb3a83 /drivers
parentfceb5d1b19cbe6263f09dbe8e8138edf02eb6e6b (diff)
null_blk: create a helper for req completion
This patch creates a helper function for handling the request completion in the null_handle_cmd(). Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/null_blk_main.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index bf40c3115bb9..b26a178d064d 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -1182,6 +1182,32 @@ static inline blk_status_t null_handle_memory_backed(struct nullb_cmd *cmd,
return errno_to_blk_status(err);
}
+static inline void nullb_complete_cmd(struct nullb_cmd *cmd)
+{
+ /* Complete IO by inline, softirq or timer */
+ switch (cmd->nq->dev->irqmode) {
+ case NULL_IRQ_SOFTIRQ:
+ switch (cmd->nq->dev->queue_mode) {
+ case NULL_Q_MQ:
+ blk_mq_complete_request(cmd->rq);
+ break;
+ case NULL_Q_BIO:
+ /*
+ * XXX: no proper submitting cpu information available.
+ */
+ end_cmd(cmd);
+ break;
+ }
+ break;
+ case NULL_IRQ_NONE:
+ end_cmd(cmd);
+ break;
+ case NULL_IRQ_TIMER:
+ null_cmd_end_timer(cmd);
+ break;
+ }
+}
+
static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector,
sector_t nr_sectors, enum req_opf op)
{
@@ -1213,28 +1239,7 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector,
cmd->error = null_handle_zoned(cmd, op, sector, nr_sectors);
out:
- /* Complete IO by inline, softirq or timer */
- switch (dev->irqmode) {
- case NULL_IRQ_SOFTIRQ:
- switch (dev->queue_mode) {
- case NULL_Q_MQ:
- blk_mq_complete_request(cmd->rq);
- break;
- case NULL_Q_BIO:
- /*
- * XXX: no proper submitting cpu information available.
- */
- end_cmd(cmd);
- break;
- }
- break;
- case NULL_IRQ_NONE:
- end_cmd(cmd);
- break;
- case NULL_IRQ_TIMER:
- null_cmd_end_timer(cmd);
- break;
- }
+ nullb_complete_cmd(cmd);
return BLK_STS_OK;
}