diff options
Diffstat (limited to 'include/linux/blkdev.h')
| -rw-r--r-- | include/linux/blkdev.h | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0d84981ee03f..3cd426e971db 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -90,15 +90,15 @@ enum rq_cmd_type_bits { | |||
| 90 | #define BLK_MAX_CDB 16 | 90 | #define BLK_MAX_CDB 16 |
| 91 | 91 | ||
| 92 | /* | 92 | /* |
| 93 | * try to put the fields that are referenced together in the same cacheline. | 93 | * Try to put the fields that are referenced together in the same cacheline. |
| 94 | * if you modify this structure, be sure to check block/blk-core.c:blk_rq_init() | 94 | * |
| 95 | * as well! | 95 | * If you modify this structure, make sure to update blk_rq_init() and |
| 96 | * especially blk_mq_rq_ctx_init() to take care of the added fields. | ||
| 96 | */ | 97 | */ |
| 97 | struct request { | 98 | struct request { |
| 98 | struct list_head queuelist; | 99 | struct list_head queuelist; |
| 99 | union { | 100 | union { |
| 100 | struct call_single_data csd; | 101 | struct call_single_data csd; |
| 101 | struct work_struct mq_flush_work; | ||
| 102 | unsigned long fifo_time; | 102 | unsigned long fifo_time; |
| 103 | }; | 103 | }; |
| 104 | 104 | ||
| @@ -178,7 +178,6 @@ struct request { | |||
| 178 | unsigned short ioprio; | 178 | unsigned short ioprio; |
| 179 | 179 | ||
| 180 | void *special; /* opaque pointer available for LLD use */ | 180 | void *special; /* opaque pointer available for LLD use */ |
| 181 | char *buffer; /* kaddr of the current segment if available */ | ||
| 182 | 181 | ||
| 183 | int tag; | 182 | int tag; |
| 184 | int errors; | 183 | int errors; |
| @@ -336,7 +335,7 @@ struct request_queue { | |||
| 336 | unsigned int *mq_map; | 335 | unsigned int *mq_map; |
| 337 | 336 | ||
| 338 | /* sw queues */ | 337 | /* sw queues */ |
| 339 | struct blk_mq_ctx *queue_ctx; | 338 | struct blk_mq_ctx __percpu *queue_ctx; |
| 340 | unsigned int nr_queues; | 339 | unsigned int nr_queues; |
| 341 | 340 | ||
| 342 | /* hw dispatch queues */ | 341 | /* hw dispatch queues */ |
| @@ -463,6 +462,10 @@ struct request_queue { | |||
| 463 | struct request *flush_rq; | 462 | struct request *flush_rq; |
| 464 | spinlock_t mq_flush_lock; | 463 | spinlock_t mq_flush_lock; |
| 465 | 464 | ||
| 465 | struct list_head requeue_list; | ||
| 466 | spinlock_t requeue_lock; | ||
| 467 | struct work_struct requeue_work; | ||
| 468 | |||
| 466 | struct mutex sysfs_lock; | 469 | struct mutex sysfs_lock; |
| 467 | 470 | ||
| 468 | int bypass_depth; | 471 | int bypass_depth; |
| @@ -481,6 +484,9 @@ struct request_queue { | |||
| 481 | wait_queue_head_t mq_freeze_wq; | 484 | wait_queue_head_t mq_freeze_wq; |
| 482 | struct percpu_counter mq_usage_counter; | 485 | struct percpu_counter mq_usage_counter; |
| 483 | struct list_head all_q_node; | 486 | struct list_head all_q_node; |
| 487 | |||
| 488 | struct blk_mq_tag_set *tag_set; | ||
| 489 | struct list_head tag_set_list; | ||
| 484 | }; | 490 | }; |
| 485 | 491 | ||
| 486 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ | 492 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ |
| @@ -504,6 +510,7 @@ struct request_queue { | |||
| 504 | #define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ | 510 | #define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ |
| 505 | #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ | 511 | #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ |
| 506 | #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ | 512 | #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ |
| 513 | #define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/ | ||
| 507 | 514 | ||
| 508 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 515 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
| 509 | (1 << QUEUE_FLAG_STACKABLE) | \ | 516 | (1 << QUEUE_FLAG_STACKABLE) | \ |
| @@ -613,6 +620,15 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | |||
| 613 | 620 | ||
| 614 | #define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0) | 621 | #define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0) |
| 615 | 622 | ||
| 623 | /* | ||
| 624 | * Driver can handle struct request, if it either has an old style | ||
| 625 | * request_fn defined, or is blk-mq based. | ||
| 626 | */ | ||
| 627 | static inline bool queue_is_rq_based(struct request_queue *q) | ||
| 628 | { | ||
| 629 | return q->request_fn || q->mq_ops; | ||
| 630 | } | ||
| 631 | |||
| 616 | static inline unsigned int blk_queue_cluster(struct request_queue *q) | 632 | static inline unsigned int blk_queue_cluster(struct request_queue *q) |
| 617 | { | 633 | { |
| 618 | return q->limits.cluster; | 634 | return q->limits.cluster; |
| @@ -937,6 +953,7 @@ extern struct request *blk_fetch_request(struct request_queue *q); | |||
| 937 | */ | 953 | */ |
| 938 | extern bool blk_update_request(struct request *rq, int error, | 954 | extern bool blk_update_request(struct request *rq, int error, |
| 939 | unsigned int nr_bytes); | 955 | unsigned int nr_bytes); |
| 956 | extern void blk_finish_request(struct request *rq, int error); | ||
| 940 | extern bool blk_end_request(struct request *rq, int error, | 957 | extern bool blk_end_request(struct request *rq, int error, |
| 941 | unsigned int nr_bytes); | 958 | unsigned int nr_bytes); |
| 942 | extern void blk_end_request_all(struct request *rq, int error); | 959 | extern void blk_end_request_all(struct request *rq, int error); |
| @@ -1053,7 +1070,6 @@ static inline void blk_post_runtime_resume(struct request_queue *q, int err) {} | |||
| 1053 | * schedule() where blk_schedule_flush_plug() is called. | 1070 | * schedule() where blk_schedule_flush_plug() is called. |
| 1054 | */ | 1071 | */ |
| 1055 | struct blk_plug { | 1072 | struct blk_plug { |
| 1056 | unsigned long magic; /* detect uninitialized use-cases */ | ||
| 1057 | struct list_head list; /* requests */ | 1073 | struct list_head list; /* requests */ |
| 1058 | struct list_head mq_list; /* blk-mq requests */ | 1074 | struct list_head mq_list; /* blk-mq requests */ |
| 1059 | struct list_head cb_list; /* md requires an unplug callback */ | 1075 | struct list_head cb_list; /* md requires an unplug callback */ |
| @@ -1102,7 +1118,8 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk) | |||
| 1102 | /* | 1118 | /* |
| 1103 | * tag stuff | 1119 | * tag stuff |
| 1104 | */ | 1120 | */ |
| 1105 | #define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) | 1121 | #define blk_rq_tagged(rq) \ |
| 1122 | ((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED)) | ||
| 1106 | extern int blk_queue_start_tag(struct request_queue *, struct request *); | 1123 | extern int blk_queue_start_tag(struct request_queue *, struct request *); |
| 1107 | extern struct request *blk_queue_find_tag(struct request_queue *, int); | 1124 | extern struct request *blk_queue_find_tag(struct request_queue *, int); |
| 1108 | extern void blk_queue_end_tag(struct request_queue *, struct request *); | 1125 | extern void blk_queue_end_tag(struct request_queue *, struct request *); |
| @@ -1370,8 +1387,9 @@ static inline void put_dev_sector(Sector p) | |||
| 1370 | } | 1387 | } |
| 1371 | 1388 | ||
| 1372 | struct work_struct; | 1389 | struct work_struct; |
| 1373 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); | 1390 | int kblockd_schedule_work(struct work_struct *work); |
| 1374 | int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay); | 1391 | int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long delay); |
| 1392 | int kblockd_schedule_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay); | ||
| 1375 | 1393 | ||
| 1376 | #ifdef CONFIG_BLK_CGROUP | 1394 | #ifdef CONFIG_BLK_CGROUP |
| 1377 | /* | 1395 | /* |
| @@ -1570,6 +1588,7 @@ static inline bool blk_integrity_is_initialized(struct gendisk *g) | |||
| 1570 | struct block_device_operations { | 1588 | struct block_device_operations { |
| 1571 | int (*open) (struct block_device *, fmode_t); | 1589 | int (*open) (struct block_device *, fmode_t); |
| 1572 | void (*release) (struct gendisk *, fmode_t); | 1590 | void (*release) (struct gendisk *, fmode_t); |
| 1591 | int (*rw_page)(struct block_device *, sector_t, struct page *, int rw); | ||
| 1573 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1592 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
| 1574 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1593 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
| 1575 | int (*direct_access) (struct block_device *, sector_t, | 1594 | int (*direct_access) (struct block_device *, sector_t, |
| @@ -1588,7 +1607,13 @@ struct block_device_operations { | |||
| 1588 | 1607 | ||
| 1589 | extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, | 1608 | extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, |
| 1590 | unsigned long); | 1609 | unsigned long); |
| 1610 | extern int bdev_read_page(struct block_device *, sector_t, struct page *); | ||
| 1611 | extern int bdev_write_page(struct block_device *, sector_t, struct page *, | ||
| 1612 | struct writeback_control *); | ||
| 1591 | #else /* CONFIG_BLOCK */ | 1613 | #else /* CONFIG_BLOCK */ |
| 1614 | |||
| 1615 | struct block_device; | ||
| 1616 | |||
| 1592 | /* | 1617 | /* |
| 1593 | * stubs for when the block layer is configured out | 1618 | * stubs for when the block layer is configured out |
| 1594 | */ | 1619 | */ |
| @@ -1624,6 +1649,12 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk) | |||
| 1624 | return false; | 1649 | return false; |
| 1625 | } | 1650 | } |
| 1626 | 1651 | ||
| 1652 | static inline int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | ||
| 1653 | sector_t *error_sector) | ||
| 1654 | { | ||
| 1655 | return 0; | ||
| 1656 | } | ||
| 1657 | |||
| 1627 | #endif /* CONFIG_BLOCK */ | 1658 | #endif /* CONFIG_BLOCK */ |
| 1628 | 1659 | ||
| 1629 | #endif | 1660 | #endif |
