mq-deadline: Introduce zone locking support
authorDamien Le Moal <damien.lemoal@wdc.com>
Thu, 21 Dec 2017 06:43:40 +0000 (15:43 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 5 Jan 2018 16:22:17 +0000 (09:22 -0700)
commit5700f69178e91a6b21250049b86148ed5e9550c1
tree08f8ffdbd9218095acbf40905b538800e21eff79
parentbf09ce56f0e654b94d980b9aa89e3fce78887e01
mq-deadline: Introduce zone locking support

Introduce zone write locking to avoid write request reordering with
zoned block devices. This is achieved using a finer selection of the
next request to dispatch:
1) Any non-write request is always allowed to proceed.
2) Any write to a conventional zone is always allowed to proceed.
3) For a write to a sequential zone, the zone lock is first checked.
   a) If the zone is not locked, the write is allowed to proceed after
      its target zone is locked.
   b) If the zone is locked, the write request is skipped and the next
      request in the dispatch queue tested (back to step 1).

For a write request that has locked its target zone, the zone is
unlocked either when the request completes with a call to the method
deadline_request_completed() or when the request is requeued using
dd_insert_request().

Requests targeting a locked zone are always left in the scheduler queue
to preserve the lba ordering for write requests. If no write request
can be dispatched, allow reads to be dispatched even if the write batch
is not done.

If the device used is not a zoned block device, or if zoned block device
support is disabled, this patch does not modify mq-deadline behavior.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/mq-deadline.c