diff options
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 84b15d54f8c2..c7a6d3b5bc7b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/wait.h> | 14 | #include <linux/wait.h> |
15 | #include <linux/mempool.h> | 15 | #include <linux/mempool.h> |
16 | #include <linux/bio.h> | 16 | #include <linux/bio.h> |
17 | #include <linux/module.h> | ||
18 | #include <linux/stringify.h> | 17 | #include <linux/stringify.h> |
19 | #include <linux/gfp.h> | 18 | #include <linux/gfp.h> |
20 | #include <linux/bsg.h> | 19 | #include <linux/bsg.h> |
@@ -22,6 +21,7 @@ | |||
22 | 21 | ||
23 | #include <asm/scatterlist.h> | 22 | #include <asm/scatterlist.h> |
24 | 23 | ||
24 | struct module; | ||
25 | struct scsi_ioctl_command; | 25 | struct scsi_ioctl_command; |
26 | 26 | ||
27 | struct request_queue; | 27 | struct request_queue; |
@@ -195,7 +195,7 @@ struct request_pm_state | |||
195 | #include <linux/elevator.h> | 195 | #include <linux/elevator.h> |
196 | 196 | ||
197 | typedef void (request_fn_proc) (struct request_queue *q); | 197 | typedef void (request_fn_proc) (struct request_queue *q); |
198 | typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); | 198 | typedef void (make_request_fn) (struct request_queue *q, struct bio *bio); |
199 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); | 199 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); |
200 | typedef void (unprep_rq_fn) (struct request_queue *, struct request *); | 200 | typedef void (unprep_rq_fn) (struct request_queue *, struct request *); |
201 | 201 | ||
@@ -680,6 +680,8 @@ extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, | |||
680 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, | 680 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
681 | struct scsi_ioctl_command __user *); | 681 | struct scsi_ioctl_command __user *); |
682 | 682 | ||
683 | extern void blk_queue_bio(struct request_queue *q, struct bio *bio); | ||
684 | |||
683 | /* | 685 | /* |
684 | * A queue has just exitted congestion. Note this in the global counter of | 686 | * A queue has just exitted congestion. Note this in the global counter of |
685 | * congested queues, and wake up anyone who was waiting for requests to be | 687 | * congested queues, and wake up anyone who was waiting for requests to be |
@@ -863,17 +865,22 @@ struct request_queue *blk_alloc_queue_node(gfp_t, int); | |||
863 | extern void blk_put_queue(struct request_queue *); | 865 | extern void blk_put_queue(struct request_queue *); |
864 | 866 | ||
865 | /* | 867 | /* |
866 | * Note: Code in between changing the blk_plug list/cb_list or element of such | 868 | * blk_plug permits building a queue of related requests by holding the I/O |
867 | * lists is preemptable, but such code can't do sleep (or be very careful), | 869 | * fragments for a short period. This allows merging of sequential requests |
868 | * otherwise data is corrupted. For details, please check schedule() where | 870 | * into single larger request. As the requests are moved from a per-task list to |
869 | * blk_schedule_flush_plug() is called. | 871 | * the device's request_queue in a batch, this results in improved scalability |
872 | * as the lock contention for request_queue lock is reduced. | ||
873 | * | ||
874 | * It is ok not to disable preemption when adding the request to the plug list | ||
875 | * or when attempting a merge, because blk_schedule_flush_list() will only flush | ||
876 | * the plug list when the task sleeps by itself. For details, please see | ||
877 | * schedule() where blk_schedule_flush_plug() is called. | ||
870 | */ | 878 | */ |
871 | struct blk_plug { | 879 | struct blk_plug { |
872 | unsigned long magic; | 880 | unsigned long magic; /* detect uninitialized use-cases */ |
873 | struct list_head list; | 881 | struct list_head list; /* requests */ |
874 | struct list_head cb_list; | 882 | struct list_head cb_list; /* md requires an unplug callback */ |
875 | unsigned int should_sort; | 883 | unsigned int should_sort; /* list to be sorted before flushing? */ |
876 | unsigned int count; | ||
877 | }; | 884 | }; |
878 | #define BLK_MAX_REQUEST_COUNT 16 | 885 | #define BLK_MAX_REQUEST_COUNT 16 |
879 | 886 | ||
@@ -1190,20 +1197,6 @@ static inline uint64_t rq_io_start_time_ns(struct request *req) | |||
1190 | } | 1197 | } |
1191 | #endif | 1198 | #endif |
1192 | 1199 | ||
1193 | #ifdef CONFIG_BLK_DEV_THROTTLING | ||
1194 | extern int blk_throtl_init(struct request_queue *q); | ||
1195 | extern void blk_throtl_exit(struct request_queue *q); | ||
1196 | extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); | ||
1197 | #else /* CONFIG_BLK_DEV_THROTTLING */ | ||
1198 | static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) | ||
1199 | { | ||
1200 | return 0; | ||
1201 | } | ||
1202 | |||
1203 | static inline int blk_throtl_init(struct request_queue *q) { return 0; } | ||
1204 | static inline int blk_throtl_exit(struct request_queue *q) { return 0; } | ||
1205 | #endif /* CONFIG_BLK_DEV_THROTTLING */ | ||
1206 | |||
1207 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ | 1200 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ |
1208 | MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) | 1201 | MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) |
1209 | #define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ | 1202 | #define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ |