aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/blk-mq.h
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2015-01-23 16:18:00 -0500
committerJens Axboe <axboe@fb.com>2015-01-23 16:18:00 -0500
commit24391c0dc57c3756a219defaa781e68637d6ab7d (patch)
tree4d0e5b213c017e622d69d916c9e13e7f6e805368 /include/linux/blk-mq.h
parentee1b6f7aff94019c09e73837054979063f722046 (diff)
blk-mq: add tag allocation policy
This is the blk-mq part to support tag allocation policy. The default allocation policy isn't changed (though it's not a strict FIFO). The new policy is round-robin for libata. But it's a try-best implementation. If multiple tasks are competing, the tags returned will be mixed (which is unavoidable even with !mq, as requests from different tasks can be mixed in queue) Cc: Jens Axboe <axboe@fb.com> Cc: Tejun Heo <tj@kernel.org> Cc: Christoph Hellwig <hch@infradead.org> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux/blk-mq.h')
-rw-r--r--include/linux/blk-mq.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 5b6500c77ed2..86b08b1a5eba 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -147,6 +147,8 @@ enum {
147 BLK_MQ_F_SG_MERGE = 1 << 2, 147 BLK_MQ_F_SG_MERGE = 1 << 2,
148 BLK_MQ_F_SYSFS_UP = 1 << 3, 148 BLK_MQ_F_SYSFS_UP = 1 << 3,
149 BLK_MQ_F_DEFER_ISSUE = 1 << 4, 149 BLK_MQ_F_DEFER_ISSUE = 1 << 4,
150 BLK_MQ_F_ALLOC_POLICY_START_BIT = 8,
151 BLK_MQ_F_ALLOC_POLICY_BITS = 1,
150 152
151 BLK_MQ_S_STOPPED = 0, 153 BLK_MQ_S_STOPPED = 0,
152 BLK_MQ_S_TAG_ACTIVE = 1, 154 BLK_MQ_S_TAG_ACTIVE = 1,
@@ -155,6 +157,12 @@ enum {
155 157
156 BLK_MQ_CPU_WORK_BATCH = 8, 158 BLK_MQ_CPU_WORK_BATCH = 8,
157}; 159};
160#define BLK_MQ_FLAG_TO_ALLOC_POLICY(flags) \
161 ((flags >> BLK_MQ_F_ALLOC_POLICY_START_BIT) & \
162 ((1 << BLK_MQ_F_ALLOC_POLICY_BITS) - 1))
163#define BLK_ALLOC_POLICY_TO_MQ_FLAG(policy) \
164 ((policy & ((1 << BLK_MQ_F_ALLOC_POLICY_BITS) - 1)) \
165 << BLK_MQ_F_ALLOC_POLICY_START_BIT)
158 166
159struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *); 167struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
160void blk_mq_finish_init(struct request_queue *q); 168void blk_mq_finish_init(struct request_queue *q);