Get rid of all the PFN arithmetics and just use an enum for the two remaining options, and use PageHighMem for the actual bounce decision. Add a fast path to entirely avoid the call for the common case of a queue not using the legacy bouncing code.
Showing the changes to include/linux/blkdev.h (1 of 5 files). Show all
Unified · Split
| @@ -313,8 +313,17 @@ enum blk_zoned_model { · 312 unmodified lines | |||
| 313 | BLK_ZONED_HM, /* Host-managed zoned block device */ | 313 | BLK_ZONED_HM, /* Host-managed zoned block device */ |
| 314 | }; | 314 | }; |
| 315 | 315 | ||
| 316 | /* | ||
| 317 | * BLK_BOUNCE_NONE: never bounce (default) | ||
| 318 | * BLK_BOUNCE_HIGH: bounce all highmem pages | ||
| 319 | */ | ||
| 320 | enum blk_bounce { | ||
| 321 | BLK_BOUNCE_NONE, | ||
| 322 | BLK_BOUNCE_HIGH, | ||
| 323 | }; | ||
| 324 | |||
| 316 | struct queue_limits { | 325 | struct queue_limits { |
| 317 | unsigned long bounce_pfn; | 326 | enum blk_bounce bounce; |
| 318 | unsigned long seg_boundary_mask; | 327 | unsigned long seg_boundary_mask; |
| 319 | unsigned long virt_boundary_mask; | 328 | unsigned long virt_boundary_mask; |
| 320 | 329 | ||
| @@ -835,22 +844,6 @@ static inline unsigned int blk_queue_depth(struct request_queue *q) · 514 unmodified lines | |||
| 835 | return q->nr_requests; | 844 | return q->nr_requests; |
| 836 | } | 845 | } |
| 837 | 846 | ||
| 838 | extern unsigned long blk_max_low_pfn, blk_max_pfn; | ||
| 839 | |||
| 840 | /* | ||
| 841 | * standard bounce addresses: | ||
| 842 | * | ||
| 843 | * BLK_BOUNCE_HIGH : bounce all highmem pages | ||
| 844 | * BLK_BOUNCE_ANY : don't bounce anything | ||
| 845 | */ | ||
| 846 | |||
| 847 | #if BITS_PER_LONG == 32 | ||
| 848 | #define BLK_BOUNCE_HIGH ((u64)blk_max_low_pfn << PAGE_SHIFT) | ||
| 849 | #else | ||
| 850 | #define BLK_BOUNCE_HIGH -1ULL | ||
| 851 | #endif | ||
| 852 | #define BLK_BOUNCE_ANY (-1ULL) | ||
| 853 | |||
| 854 | /* | 847 | /* |
| 855 | * default timeout for SG_IO if none specified | 848 | * default timeout for SG_IO if none specified |
| 856 | */ | 849 | */ |
| @@ -1134,7 +1127,7 @@ extern void blk_abort_request(struct request *); · 277 unmodified lines | |||
| 1134 | * Access functions for manipulating queue properties | 1127 | * Access functions for manipulating queue properties |
| 1135 | */ | 1128 | */ |
| 1136 | extern void blk_cleanup_queue(struct request_queue *); | 1129 | extern void blk_cleanup_queue(struct request_queue *); |
| 1137 | extern void blk_queue_bounce_limit(struct request_queue *, u64); | 1130 | void blk_queue_bounce_limit(struct request_queue *q, enum blk_bounce limit); |
| 1138 | extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); | 1131 | extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); |
| 1139 | extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int); | 1132 | extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int); |
| 1140 | extern void blk_queue_max_segments(struct request_queue *, unsigned short); | 1133 | extern void blk_queue_max_segments(struct request_queue *, unsigned short); |