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

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

parent 7edfd681
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -575,14 +575,14 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q,

	if (!plug)
		return NULL;

	if (rq_list_empty(plug->cached_rq)) {
		if (plug->nr_ios == 1)
			return NULL;
		rq = blk_mq_rq_cache_fill(q, plug, opf, flags);
		if (rq)
			goto got_it;
		if (!rq)
			return NULL;
	}
	} else {
		rq = rq_list_peek(&plug->cached_rq);
		if (!rq || rq->q != q)
			return NULL;
@@ -593,7 +593,8 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q,
			return NULL;

		plug->cached_rq = rq_list_next(rq);
got_it:
	}

	rq->cmd_flags = opf;
	INIT_LIST_HEAD(&rq->queuelist);
	return rq;