History

block: add block polling support

Add basic support for polling for specific IO to complete. This uses the cookie that blk-mq passes back, which enables the block layer to pass this cookie to the driver to spin for a specific request. This will be combined with request latency tracking, so we can make qualified decisions about when to poll and when not to. For now, for benchmark purposes, we add a sysfs file that controls whether polling is enabled or not.

Jens Axboe committed 11 years ago

Commit 05229be1 parent 7b371635 files · +99 −0Browse files

Showing the changes to include/linux/blkdev.h (1 of 5 files). Show all

Unified · Split

include/linux/blkdev.h+3−0
@@ -487,6 +487,7 @@ struct request_queue { · 486 unmodified lines
487#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */487#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */
488#define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */488#define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */
489#define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/489#define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/
490#define QUEUE_FLAG_POLL 22 /* IO polling enabled if set */
490 491
491#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \492#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
492 (1 << QUEUE_FLAG_STACKABLE) | \493 (1 << QUEUE_FLAG_STACKABLE) | \
@@ -814,6 +815,8 @@ extern int blk_execute_rq(struct request_queue *, struct gendisk *, · 321 unmodified lines
814extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,815extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
815 struct request *, int, rq_end_io_fn *);816 struct request *, int, rq_end_io_fn *);
816 817
818bool blk_poll(struct request_queue *q, blk_qc_t cookie);
819
817static inline struct request_queue *bdev_get_queue(struct block_device *bdev)820static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
818{821{
819 return bdev->bd_disk->queue; /* this is never NULL */822 return bdev->bd_disk->queue; /* this is never NULL */