diff options
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 221cecd86bd3..784a919aa0d0 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -312,13 +312,17 @@ struct queue_limits { | |||
312 | unsigned int io_min; | 312 | unsigned int io_min; |
313 | unsigned int io_opt; | 313 | unsigned int io_opt; |
314 | unsigned int max_discard_sectors; | 314 | unsigned int max_discard_sectors; |
315 | unsigned int discard_granularity; | ||
316 | unsigned int discard_alignment; | ||
315 | 317 | ||
316 | unsigned short logical_block_size; | 318 | unsigned short logical_block_size; |
317 | unsigned short max_hw_segments; | 319 | unsigned short max_hw_segments; |
318 | unsigned short max_phys_segments; | 320 | unsigned short max_phys_segments; |
319 | 321 | ||
320 | unsigned char misaligned; | 322 | unsigned char misaligned; |
323 | unsigned char discard_misaligned; | ||
321 | unsigned char no_cluster; | 324 | unsigned char no_cluster; |
325 | signed char discard_zeroes_data; | ||
322 | }; | 326 | }; |
323 | 327 | ||
324 | struct request_queue | 328 | struct request_queue |
@@ -749,6 +753,17 @@ struct req_iterator { | |||
749 | #define rq_iter_last(rq, _iter) \ | 753 | #define rq_iter_last(rq, _iter) \ |
750 | (_iter.bio->bi_next == NULL && _iter.i == _iter.bio->bi_vcnt-1) | 754 | (_iter.bio->bi_next == NULL && _iter.i == _iter.bio->bi_vcnt-1) |
751 | 755 | ||
756 | #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE | ||
757 | # error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform" | ||
758 | #endif | ||
759 | #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE | ||
760 | extern void rq_flush_dcache_pages(struct request *rq); | ||
761 | #else | ||
762 | static inline void rq_flush_dcache_pages(struct request *rq) | ||
763 | { | ||
764 | } | ||
765 | #endif | ||
766 | |||
752 | extern int blk_register_queue(struct gendisk *disk); | 767 | extern int blk_register_queue(struct gendisk *disk); |
753 | extern void blk_unregister_queue(struct gendisk *disk); | 768 | extern void blk_unregister_queue(struct gendisk *disk); |
754 | extern void register_disk(struct gendisk *dev); | 769 | extern void register_disk(struct gendisk *dev); |
@@ -823,19 +838,6 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev) | |||
823 | return bdev->bd_disk->queue; | 838 | return bdev->bd_disk->queue; |
824 | } | 839 | } |
825 | 840 | ||
826 | static inline void blk_run_backing_dev(struct backing_dev_info *bdi, | ||
827 | struct page *page) | ||
828 | { | ||
829 | if (bdi && bdi->unplug_io_fn) | ||
830 | bdi->unplug_io_fn(bdi, page); | ||
831 | } | ||
832 | |||
833 | static inline void blk_run_address_space(struct address_space *mapping) | ||
834 | { | ||
835 | if (mapping) | ||
836 | blk_run_backing_dev(mapping->backing_dev_info, NULL); | ||
837 | } | ||
838 | |||
839 | /* | 841 | /* |
840 | * blk_rq_pos() : the current sector | 842 | * blk_rq_pos() : the current sector |
841 | * blk_rq_bytes() : bytes left in the entire request | 843 | * blk_rq_bytes() : bytes left in the entire request |
@@ -1134,6 +1136,34 @@ static inline int bdev_alignment_offset(struct block_device *bdev) | |||
1134 | return q->limits.alignment_offset; | 1136 | return q->limits.alignment_offset; |
1135 | } | 1137 | } |
1136 | 1138 | ||
1139 | static inline int queue_discard_alignment(struct request_queue *q) | ||
1140 | { | ||
1141 | if (q->limits.discard_misaligned) | ||
1142 | return -1; | ||
1143 | |||
1144 | return q->limits.discard_alignment; | ||
1145 | } | ||
1146 | |||
1147 | static inline int queue_sector_discard_alignment(struct request_queue *q, | ||
1148 | sector_t sector) | ||
1149 | { | ||
1150 | return ((sector << 9) - q->limits.discard_alignment) | ||
1151 | & (q->limits.discard_granularity - 1); | ||
1152 | } | ||
1153 | |||
1154 | static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) | ||
1155 | { | ||
1156 | if (q->limits.discard_zeroes_data == 1) | ||
1157 | return 1; | ||
1158 | |||
1159 | return 0; | ||
1160 | } | ||
1161 | |||
1162 | static inline unsigned int bdev_discard_zeroes_data(struct block_device *bdev) | ||
1163 | { | ||
1164 | return queue_discard_zeroes_data(bdev_get_queue(bdev)); | ||
1165 | } | ||
1166 | |||
1137 | static inline int queue_dma_alignment(struct request_queue *q) | 1167 | static inline int queue_dma_alignment(struct request_queue *q) |
1138 | { | 1168 | { |
1139 | return q ? q->dma_alignment : 511; | 1169 | return q ? q->dma_alignment : 511; |