block: move queues types to the block layer

Having another indirect all in the fast path doesn't really help
in our post-spectre world.  Also having too many queue type is just
going to create confusion, so I'd rather manage them centrally.

Note that the queue type naming and ordering changes a bit - the
first index now is the default queue for everything not explicitly
marked, the optional ones are read and poll queues.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig
2018-12-02 17:46:16 +01:00
committed by Jens Axboe
parent 154989e45f
commit e20ba6e1da
4 changed files with 51 additions and 62 deletions

View File

@@ -81,8 +81,12 @@ struct blk_mq_queue_map {
unsigned int queue_offset;
};
enum {
HCTX_MAX_TYPES = 3,
enum hctx_type {
HCTX_TYPE_DEFAULT, /* all I/O not otherwise accounted for */
HCTX_TYPE_READ, /* just for READ I/O */
HCTX_TYPE_POLL, /* polled I/O of any kind */
HCTX_MAX_TYPES,
};
struct blk_mq_tag_set {
@@ -118,8 +122,6 @@ struct blk_mq_queue_data {
typedef blk_status_t (queue_rq_fn)(struct blk_mq_hw_ctx *,
const struct blk_mq_queue_data *);
typedef void (commit_rqs_fn)(struct blk_mq_hw_ctx *);
/* takes rq->cmd_flags as input, returns a hardware type index */
typedef int (rq_flags_to_type_fn)(struct request_queue *, unsigned int);
typedef bool (get_budget_fn)(struct blk_mq_hw_ctx *);
typedef void (put_budget_fn)(struct blk_mq_hw_ctx *);
typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool);
@@ -154,11 +156,6 @@ struct blk_mq_ops {
*/
commit_rqs_fn *commit_rqs;
/*
* Return a queue map type for the given request/bio flags
*/
rq_flags_to_type_fn *rq_flags_to_type;
/*
* Reserve budget before queue request, once .queue_rq is
* run, it is driver's responsibility to release the