diff options
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0a8da96274c3..f26ec20f6354 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/major.h> | 8 | #include <linux/major.h> |
9 | #include <linux/genhd.h> | 9 | #include <linux/genhd.h> |
10 | #include <linux/list.h> | 10 | #include <linux/list.h> |
11 | #include <linux/llist.h> | ||
11 | #include <linux/timer.h> | 12 | #include <linux/timer.h> |
12 | #include <linux/workqueue.h> | 13 | #include <linux/workqueue.h> |
13 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
@@ -94,10 +95,17 @@ enum rq_cmd_type_bits { | |||
94 | * as well! | 95 | * as well! |
95 | */ | 96 | */ |
96 | struct request { | 97 | struct request { |
97 | struct list_head queuelist; | 98 | union { |
98 | struct call_single_data csd; | 99 | struct list_head queuelist; |
100 | struct llist_node ll_list; | ||
101 | }; | ||
102 | union { | ||
103 | struct call_single_data csd; | ||
104 | struct work_struct mq_flush_data; | ||
105 | }; | ||
99 | 106 | ||
100 | struct request_queue *q; | 107 | struct request_queue *q; |
108 | struct blk_mq_ctx *mq_ctx; | ||
101 | 109 | ||
102 | u64 cmd_flags; | 110 | u64 cmd_flags; |
103 | enum rq_cmd_type_bits cmd_type; | 111 | enum rq_cmd_type_bits cmd_type; |
@@ -213,6 +221,8 @@ struct request_pm_state | |||
213 | 221 | ||
214 | #include <linux/elevator.h> | 222 | #include <linux/elevator.h> |
215 | 223 | ||
224 | struct blk_queue_ctx; | ||
225 | |||
216 | typedef void (request_fn_proc) (struct request_queue *q); | 226 | typedef void (request_fn_proc) (struct request_queue *q); |
217 | typedef void (make_request_fn) (struct request_queue *q, struct bio *bio); | 227 | typedef void (make_request_fn) (struct request_queue *q, struct bio *bio); |
218 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); | 228 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); |
@@ -311,6 +321,18 @@ struct request_queue { | |||
311 | dma_drain_needed_fn *dma_drain_needed; | 321 | dma_drain_needed_fn *dma_drain_needed; |
312 | lld_busy_fn *lld_busy_fn; | 322 | lld_busy_fn *lld_busy_fn; |
313 | 323 | ||
324 | struct blk_mq_ops *mq_ops; | ||
325 | |||
326 | unsigned int *mq_map; | ||
327 | |||
328 | /* sw queues */ | ||
329 | struct blk_mq_ctx *queue_ctx; | ||
330 | unsigned int nr_queues; | ||
331 | |||
332 | /* hw dispatch queues */ | ||
333 | struct blk_mq_hw_ctx **queue_hw_ctx; | ||
334 | unsigned int nr_hw_queues; | ||
335 | |||
314 | /* | 336 | /* |
315 | * Dispatch queue sorting | 337 | * Dispatch queue sorting |
316 | */ | 338 | */ |
@@ -359,6 +381,11 @@ struct request_queue { | |||
359 | */ | 381 | */ |
360 | struct kobject kobj; | 382 | struct kobject kobj; |
361 | 383 | ||
384 | /* | ||
385 | * mq queue kobject | ||
386 | */ | ||
387 | struct kobject mq_kobj; | ||
388 | |||
362 | #ifdef CONFIG_PM_RUNTIME | 389 | #ifdef CONFIG_PM_RUNTIME |
363 | struct device *dev; | 390 | struct device *dev; |
364 | int rpm_status; | 391 | int rpm_status; |
@@ -423,7 +450,13 @@ struct request_queue { | |||
423 | unsigned long flush_pending_since; | 450 | unsigned long flush_pending_since; |
424 | struct list_head flush_queue[2]; | 451 | struct list_head flush_queue[2]; |
425 | struct list_head flush_data_in_flight; | 452 | struct list_head flush_data_in_flight; |
426 | struct request flush_rq; | 453 | union { |
454 | struct request flush_rq; | ||
455 | struct { | ||
456 | spinlock_t mq_flush_lock; | ||
457 | struct work_struct mq_flush_work; | ||
458 | }; | ||
459 | }; | ||
427 | 460 | ||
428 | struct mutex sysfs_lock; | 461 | struct mutex sysfs_lock; |
429 | 462 | ||
@@ -435,14 +468,14 @@ struct request_queue { | |||
435 | struct bsg_class_device bsg_dev; | 468 | struct bsg_class_device bsg_dev; |
436 | #endif | 469 | #endif |
437 | 470 | ||
438 | #ifdef CONFIG_BLK_CGROUP | ||
439 | struct list_head all_q_node; | ||
440 | #endif | ||
441 | #ifdef CONFIG_BLK_DEV_THROTTLING | 471 | #ifdef CONFIG_BLK_DEV_THROTTLING |
442 | /* Throttle data */ | 472 | /* Throttle data */ |
443 | struct throtl_data *td; | 473 | struct throtl_data *td; |
444 | #endif | 474 | #endif |
445 | struct rcu_head rcu_head; | 475 | struct rcu_head rcu_head; |
476 | wait_queue_head_t mq_freeze_wq; | ||
477 | struct percpu_counter mq_usage_counter; | ||
478 | struct list_head all_q_node; | ||
446 | }; | 479 | }; |
447 | 480 | ||
448 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ | 481 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ |
@@ -465,6 +498,7 @@ struct request_queue { | |||
465 | #define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */ | 498 | #define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */ |
466 | #define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ | 499 | #define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ |
467 | #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ | 500 | #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ |
501 | #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ | ||
468 | 502 | ||
469 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 503 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
470 | (1 << QUEUE_FLAG_STACKABLE) | \ | 504 | (1 << QUEUE_FLAG_STACKABLE) | \ |
@@ -537,6 +571,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | |||
537 | #define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags) | 571 | #define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags) |
538 | #define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags) | 572 | #define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags) |
539 | #define blk_queue_bypass(q) test_bit(QUEUE_FLAG_BYPASS, &(q)->queue_flags) | 573 | #define blk_queue_bypass(q) test_bit(QUEUE_FLAG_BYPASS, &(q)->queue_flags) |
574 | #define blk_queue_init_done(q) test_bit(QUEUE_FLAG_INIT_DONE, &(q)->queue_flags) | ||
540 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) | 575 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) |
541 | #define blk_queue_noxmerges(q) \ | 576 | #define blk_queue_noxmerges(q) \ |
542 | test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) | 577 | test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) |
@@ -1011,6 +1046,7 @@ static inline void blk_post_runtime_resume(struct request_queue *q, int err) {} | |||
1011 | struct blk_plug { | 1046 | struct blk_plug { |
1012 | unsigned long magic; /* detect uninitialized use-cases */ | 1047 | unsigned long magic; /* detect uninitialized use-cases */ |
1013 | struct list_head list; /* requests */ | 1048 | struct list_head list; /* requests */ |
1049 | struct list_head mq_list; /* blk-mq requests */ | ||
1014 | struct list_head cb_list; /* md requires an unplug callback */ | 1050 | struct list_head cb_list; /* md requires an unplug callback */ |
1015 | }; | 1051 | }; |
1016 | #define BLK_MAX_REQUEST_COUNT 16 | 1052 | #define BLK_MAX_REQUEST_COUNT 16 |
@@ -1048,7 +1084,10 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk) | |||
1048 | { | 1084 | { |
1049 | struct blk_plug *plug = tsk->plug; | 1085 | struct blk_plug *plug = tsk->plug; |
1050 | 1086 | ||
1051 | return plug && (!list_empty(&plug->list) || !list_empty(&plug->cb_list)); | 1087 | return plug && |
1088 | (!list_empty(&plug->list) || | ||
1089 | !list_empty(&plug->mq_list) || | ||
1090 | !list_empty(&plug->cb_list)); | ||
1052 | } | 1091 | } |
1053 | 1092 | ||
1054 | /* | 1093 | /* |
@@ -1323,6 +1362,7 @@ static inline void put_dev_sector(Sector p) | |||
1323 | 1362 | ||
1324 | struct work_struct; | 1363 | struct work_struct; |
1325 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); | 1364 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); |
1365 | int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay); | ||
1326 | 1366 | ||
1327 | #ifdef CONFIG_BLK_CGROUP | 1367 | #ifdef CONFIG_BLK_CGROUP |
1328 | /* | 1368 | /* |