diff options
author | Shaohua Li <shli@fb.com> | 2015-01-15 20:32:25 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-01-23 16:15:46 -0500 |
commit | ee1b6f7aff94019c09e73837054979063f722046 (patch) | |
tree | 79c7b943d7c6d62fec1874afd2c50964de054aa0 /include/linux | |
parent | bb5c3cdda37aad22996d6da2addd58cadc0436c0 (diff) |
block: support different tag allocation policy
The libata tag allocation is using a round-robin policy. Next patch will
make libata use block generic tag allocation, so let's add a policy to
tag allocation.
Currently two policies: FIFO (default) and round-robin.
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')
-rw-r--r-- | include/linux/blkdev.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4c4b732d7556..6f388fd1c11c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -272,7 +272,11 @@ struct blk_queue_tag { | |||
272 | int max_depth; /* what we will send to device */ | 272 | int max_depth; /* what we will send to device */ |
273 | int real_max_depth; /* what the array can hold */ | 273 | int real_max_depth; /* what the array can hold */ |
274 | atomic_t refcnt; /* map can be shared */ | 274 | atomic_t refcnt; /* map can be shared */ |
275 | int alloc_policy; /* tag allocation policy */ | ||
276 | int next_tag; /* next tag */ | ||
275 | }; | 277 | }; |
278 | #define BLK_TAG_ALLOC_FIFO 0 /* allocate starting from 0 */ | ||
279 | #define BLK_TAG_ALLOC_RR 1 /* allocate starting from last allocated tag */ | ||
276 | 280 | ||
277 | #define BLK_SCSI_MAX_CMDS (256) | 281 | #define BLK_SCSI_MAX_CMDS (256) |
278 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | 282 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) |
@@ -1139,11 +1143,11 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk) | |||
1139 | extern int blk_queue_start_tag(struct request_queue *, struct request *); | 1143 | extern int blk_queue_start_tag(struct request_queue *, struct request *); |
1140 | extern struct request *blk_queue_find_tag(struct request_queue *, int); | 1144 | extern struct request *blk_queue_find_tag(struct request_queue *, int); |
1141 | extern void blk_queue_end_tag(struct request_queue *, struct request *); | 1145 | extern void blk_queue_end_tag(struct request_queue *, struct request *); |
1142 | extern int blk_queue_init_tags(struct request_queue *, int, struct blk_queue_tag *); | 1146 | extern int blk_queue_init_tags(struct request_queue *, int, struct blk_queue_tag *, int); |
1143 | extern void blk_queue_free_tags(struct request_queue *); | 1147 | extern void blk_queue_free_tags(struct request_queue *); |
1144 | extern int blk_queue_resize_tags(struct request_queue *, int); | 1148 | extern int blk_queue_resize_tags(struct request_queue *, int); |
1145 | extern void blk_queue_invalidate_tags(struct request_queue *); | 1149 | extern void blk_queue_invalidate_tags(struct request_queue *); |
1146 | extern struct blk_queue_tag *blk_init_tags(int); | 1150 | extern struct blk_queue_tag *blk_init_tags(int, int); |
1147 | extern void blk_free_tags(struct blk_queue_tag *); | 1151 | extern void blk_free_tags(struct blk_queue_tag *); |
1148 | 1152 | ||
1149 | static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, | 1153 | static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, |