History

block: refactor the bounce buffering code

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.

Christoph Hellwig committed 5 years ago

Commit 9bb33f21 parent ce288e05 files · +38 −90Browse files

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

Unified · Split

include/linux/blkdev.h+11−18
@@ -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 */
320enum blk_bounce {
321 BLK_BOUNCE_NONE,
322 BLK_BOUNCE_HIGH,
323};
324
316struct queue_limits {325struct 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
838extern 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 specified848 * 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 properties1127 * Access functions for manipulating queue properties
1135 */1128 */
1136extern void blk_cleanup_queue(struct request_queue *);1129extern void blk_cleanup_queue(struct request_queue *);
1137extern void blk_queue_bounce_limit(struct request_queue *, u64);1130void blk_queue_bounce_limit(struct request_queue *q, enum blk_bounce limit);
1138extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);1131extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
1139extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int);1132extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int);
1140extern void blk_queue_max_segments(struct request_queue *, unsigned short);1133extern void blk_queue_max_segments(struct request_queue *, unsigned short);