summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq-sched.c14
-rw-r--r--block/blk-mq.c17
-rw-r--r--block/blk-mq.h5
3 files changed, 8 insertions, 28 deletions
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 7775f6b12fa9..13a27d4d1671 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -94,23 +94,18 @@ static void blk_mq_do_dispatch_sched(struct blk_mq_hw_ctx *hctx)
do {
struct request *rq;
- blk_status_t ret;
if (e->type->ops.mq.has_work &&
!e->type->ops.mq.has_work(hctx))
break;
- ret = blk_mq_get_dispatch_budget(hctx);
- if (ret == BLK_STS_RESOURCE)
+ if (!blk_mq_get_dispatch_budget(hctx))
break;
rq = e->type->ops.mq.dispatch_request(hctx);
if (!rq) {
blk_mq_put_dispatch_budget(hctx);
break;
- } else if (ret != BLK_STS_OK) {
- blk_mq_end_request(rq, ret);
- continue;
}
/*
@@ -146,22 +141,17 @@ static void blk_mq_do_dispatch_ctx(struct blk_mq_hw_ctx *hctx)
do {
struct request *rq;
- blk_status_t ret;
if (!sbitmap_any_bit_set(&hctx->ctx_map))
break;
- ret = blk_mq_get_dispatch_budget(hctx);
- if (ret == BLK_STS_RESOURCE)
+ if (!blk_mq_get_dispatch_budget(hctx))
break;
rq = blk_mq_dequeue_from_ctx(hctx, ctx);
if (!rq) {
blk_mq_put_dispatch_budget(hctx);
break;
- } else if (ret != BLK_STS_OK) {
- blk_mq_end_request(rq, ret);
- continue;
}
/*
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 13cdccef543c..c9fa4b294664 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1137,13 +1137,8 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
}
}
- if (!got_budget) {
- ret = blk_mq_get_dispatch_budget(hctx);
- if (ret == BLK_STS_RESOURCE)
- break;
- if (ret != BLK_STS_OK)
- goto fail_rq;
- }
+ if (!got_budget && !blk_mq_get_dispatch_budget(hctx))
+ break;
list_del_init(&rq->queuelist);
@@ -1170,7 +1165,6 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
break;
}
- fail_rq:
if (unlikely(ret != BLK_STS_OK)) {
errors++;
blk_mq_end_request(rq, BLK_STS_IOERR);
@@ -1642,12 +1636,10 @@ static void __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
if (!blk_mq_get_driver_tag(rq, NULL, false))
goto insert;
- ret = blk_mq_get_dispatch_budget(hctx);
- if (ret == BLK_STS_RESOURCE) {
+ if (!blk_mq_get_dispatch_budget(hctx)) {
blk_mq_put_driver_tag(rq);
goto insert;
- } else if (ret != BLK_STS_OK)
- goto fail_rq;
+ }
new_cookie = request_to_qc_t(hctx, rq);
@@ -1665,7 +1657,6 @@ static void __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
__blk_mq_requeue_request(rq);
goto insert;
default:
- fail_rq:
*cookie = BLK_QC_T_NONE;
blk_mq_end_request(rq, ret);
return;
diff --git a/block/blk-mq.h b/block/blk-mq.h
index 522b420dedc0..f97aceff76e9 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -147,14 +147,13 @@ static inline void blk_mq_put_dispatch_budget(struct blk_mq_hw_ctx *hctx)
q->mq_ops->put_budget(hctx);
}
-static inline blk_status_t blk_mq_get_dispatch_budget(
- struct blk_mq_hw_ctx *hctx)
+static inline bool blk_mq_get_dispatch_budget(struct blk_mq_hw_ctx *hctx)
{
struct request_queue *q = hctx->queue;
if (q->mq_ops->get_budget)
return q->mq_ops->get_budget(hctx);
- return BLK_STS_OK;
+ return true;
}
#endif