]> git.baikalelectronics.ru Git - kernel.git/commit
blk-flush: Queue through IO scheduler when flush not required
authorJan Kara <jack@suse.com>
Thu, 12 Nov 2015 13:25:52 +0000 (14:25 +0100)
committerJens Axboe <axboe@fb.com>
Mon, 16 Nov 2015 22:23:51 +0000 (15:23 -0700)
commit0c64202272f1204dac071eb3ac3187b2ea7ca2e7
tree095d2ee5738318c4065236a14de0c03e9105d022
parentf6f9505762b2f275e3bcb9dbba438e2858c2d420
blk-flush: Queue through IO scheduler when flush not required

Currently blk_insert_flush() just adds flush request to q->queue_head
when flush is not required. That completely bypasses IO scheduler so
e.g. CFQ can be idling waiting for new request to arrive and will idle
through the whole window unnecessarily. Luckily this only happens in
rare cases as usually checks in generic_make_request_checks() clear
FLUSH and FUA flags early if they are not needed.

When no flushing is actually required, we can easily fix the problem by
properly queueing the request through the IO scheduler. Ideally IO
scheduler should be also made aware of requests queued via
blk_flush_queue_rq(). However inserting flush request through IO
scheduler can have unwanted side-effects since due to flush batching
delaying the flush request in IO scheduler will delay all flush requests
possibly coming from other processes. So we keep adding the request
directly to q->queue_head.

Signed-off-by: Jan Kara <jack@suse.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-flush.c