blk-mq: push IPI or local end_io decision to __blk_mq_complete_request()
We have callers outside of the blk-mq proper (like timeouts) that want to call __blk_mq_complete_request(), so rename the function and put the decision code for whether to use ->softirq_done_fn or blk_mq_endio() into __blk_mq_complete_request(). This also makes the interface more logical again. blk_mq_complete_request() attempts to atomically mark the request completed, and calls __blk_mq_complete_request() if successful. __blk_mq_complete_request() then just ends the request. Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
feff689412
commit
ed851860b4
|
@ -359,7 +359,7 @@ static void __blk_mq_complete_request_remote(void *data)
|
||||||
rq->q->softirq_done_fn(rq);
|
rq->q->softirq_done_fn(rq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __blk_mq_complete_request(struct request *rq)
|
static void blk_mq_ipi_complete_request(struct request *rq)
|
||||||
{
|
{
|
||||||
struct blk_mq_ctx *ctx = rq->mq_ctx;
|
struct blk_mq_ctx *ctx = rq->mq_ctx;
|
||||||
bool shared = false;
|
bool shared = false;
|
||||||
|
@ -385,6 +385,16 @@ void __blk_mq_complete_request(struct request *rq)
|
||||||
put_cpu();
|
put_cpu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __blk_mq_complete_request(struct request *rq)
|
||||||
|
{
|
||||||
|
struct request_queue *q = rq->q;
|
||||||
|
|
||||||
|
if (!q->softirq_done_fn)
|
||||||
|
blk_mq_end_io(rq, rq->errors);
|
||||||
|
else
|
||||||
|
blk_mq_ipi_complete_request(rq);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* blk_mq_complete_request - end I/O on a request
|
* blk_mq_complete_request - end I/O on a request
|
||||||
* @rq: the request being processed
|
* @rq: the request being processed
|
||||||
|
@ -399,12 +409,8 @@ void blk_mq_complete_request(struct request *rq)
|
||||||
|
|
||||||
if (unlikely(blk_should_fake_timeout(q)))
|
if (unlikely(blk_should_fake_timeout(q)))
|
||||||
return;
|
return;
|
||||||
if (!blk_mark_rq_complete(rq)) {
|
if (!blk_mark_rq_complete(rq))
|
||||||
if (q->softirq_done_fn)
|
__blk_mq_complete_request(rq);
|
||||||
__blk_mq_complete_request(rq);
|
|
||||||
else
|
|
||||||
blk_mq_end_io(rq, rq->errors);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(blk_mq_complete_request);
|
EXPORT_SYMBOL(blk_mq_complete_request);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue