Commit 40467282 authored by Jinlong Chen's avatar Jinlong Chen Committed by Jens Axboe

blk-mq: use if-else instead of goto in blk_mq_alloc_cached_request()

if-else is more readable than goto here.
Signed-off-by: default avatarJinlong Chen <nickyc975@zju.edu.cn>
Link: https://lore.kernel.org/r/d3306fa4e92dc9cc614edc8f1802686096bafef2.1667356813.git.nickyc975@zju.edu.cnSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 7edfd681
...@@ -575,14 +575,14 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q, ...@@ -575,14 +575,14 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q,
if (!plug) if (!plug)
return NULL; return NULL;
if (rq_list_empty(plug->cached_rq)) { if (rq_list_empty(plug->cached_rq)) {
if (plug->nr_ios == 1) if (plug->nr_ios == 1)
return NULL; return NULL;
rq = blk_mq_rq_cache_fill(q, plug, opf, flags); rq = blk_mq_rq_cache_fill(q, plug, opf, flags);
if (rq) if (!rq)
goto got_it;
return NULL; return NULL;
} } else {
rq = rq_list_peek(&plug->cached_rq); rq = rq_list_peek(&plug->cached_rq);
if (!rq || rq->q != q) if (!rq || rq->q != q)
return NULL; return NULL;
...@@ -593,7 +593,8 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q, ...@@ -593,7 +593,8 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q,
return NULL; return NULL;
plug->cached_rq = rq_list_next(rq); plug->cached_rq = rq_list_next(rq);
got_it: }
rq->cmd_flags = opf; rq->cmd_flags = opf;
INIT_LIST_HEAD(&rq->queuelist); INIT_LIST_HEAD(&rq->queuelist);
return rq; return rq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment