block/mq-deadline: Micro-optimize the batching algorithm
authorBart Van Assche <bvanassche@acm.org>
Fri, 18 Jun 2021 00:44:52 +0000 (17:44 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 21 Jun 2021 21:03:40 +0000 (15:03 -0600)
commitd672d325b1492f5b0e54b7226f01e2d57b58bfb4
treea9a5dea29e7aac94a5dfd5d3b2f3b36457c04eab
parent07757588e5076748308dd95ee2e3cd0b82ebb8c4
block/mq-deadline: Micro-optimize the batching algorithm

When dispatching the first request of a batch, the deadline_move_request()
call clears .next_rq[] for the opposite data direction. .next_rq[] is not
restored when changing data direction. Fix this by not clearing .next_rq[]
and by keeping track of the data direction of a batch in a variable instead.

This patch is a micro-optimization because:
- The number of deadline_next_request() calls for the read direction is
  halved.
- The number of times that deadline_next_request() returns NULL is reduced.

Cc: Damien Le Moal <damien.lemoal@wdc.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20210618004456.7280-13-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/mq-deadline.c