blk-mq: Micro-optimize blk_queue_nomerges() check
In blk_mq_make_request(), do the blk_queue_nomerges() check outside the call to blk_attempt_plug_merge() to eliminate function call overhead when nomerges=2 (disabled) Signed-off-by: Robert Elliott <elliott@hp.com> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
eba7176826
commit
da41a589f5
|
@ -1471,6 +1471,8 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req,
|
||||||
* added on the elevator at this point. In addition, we don't have
|
* added on the elevator at this point. In addition, we don't have
|
||||||
* reliable access to the elevator outside queue lock. Only check basic
|
* reliable access to the elevator outside queue lock. Only check basic
|
||||||
* merging parameters without querying the elevator.
|
* merging parameters without querying the elevator.
|
||||||
|
*
|
||||||
|
* Caller must ensure !blk_queue_nomerges(q) beforehand.
|
||||||
*/
|
*/
|
||||||
bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
|
bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
|
||||||
unsigned int *request_count)
|
unsigned int *request_count)
|
||||||
|
@ -1480,9 +1482,6 @@ bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
struct list_head *plug_list;
|
struct list_head *plug_list;
|
||||||
|
|
||||||
if (blk_queue_nomerges(q))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
plug = current->plug;
|
plug = current->plug;
|
||||||
if (!plug)
|
if (!plug)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1561,7 +1560,8 @@ void blk_queue_bio(struct request_queue *q, struct bio *bio)
|
||||||
* Check if we can merge with the plugged list before grabbing
|
* Check if we can merge with the plugged list before grabbing
|
||||||
* any locks.
|
* any locks.
|
||||||
*/
|
*/
|
||||||
if (blk_attempt_plug_merge(q, bio, &request_count))
|
if (!blk_queue_nomerges(q) &&
|
||||||
|
blk_attempt_plug_merge(q, bio, &request_count))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spin_lock_irq(q->queue_lock);
|
spin_lock_irq(q->queue_lock);
|
||||||
|
|
|
@ -1087,7 +1087,8 @@ static void blk_mq_make_request(struct request_queue *q, struct bio *bio)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_plug && blk_attempt_plug_merge(q, bio, &request_count))
|
if (use_plug && !blk_queue_nomerges(q) &&
|
||||||
|
blk_attempt_plug_merge(q, bio, &request_count))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (blk_mq_queue_enter(q)) {
|
if (blk_mq_queue_enter(q)) {
|
||||||
|
|
Loading…
Reference in New Issue