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
313313 BLK_ZONED_HM, /* Host-managed zoned block device */
314314 };
315315
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+
316325 struct queue_limits {
317− unsigned long bounce_pfn;
326+ enum blk_bounce bounce;
318327 unsigned long seg_boundary_mask;
319328 unsigned long virt_boundary_mask;
320329
@@ -835,22 +844,6 @@ static inline unsigned int blk_queue_depth(struct request_queue *q) · 514 unmodified lines
835844 return q->nr_requests;
836845 }
837846
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−
854847 /*
855848 * default timeout for SG_IO if none specified
856849 */
@@ -1134,7 +1127,7 @@ extern void blk_abort_request(struct request *); · 277 unmodified lines
11341127 * Access functions for manipulating queue properties
11351128 */
11361129 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);
11381131 extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
11391132 extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int);
11401133 extern void blk_queue_max_segments(struct request_queue *, unsigned short);