|
@@ -225,3 +225,89 @@ void blk_queue_bounce_limit(struct request_queue *q, u64 dma_mask)
|
|
|
#endif
|
|
|
if (dma) {
|
|
|
init_emergency_isa_pool();
|
|
|
+ q->bounce_gfp = GFP_NOIO | GFP_DMA;
|
|
|
+ q->limits.bounce_pfn = b_pfn;
|
|
|
+ }
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(blk_queue_bounce_limit);
|
|
|
+
|
|
|
+/**
|
|
|
+ * blk_limits_max_hw_sectors - set hard and soft limit of max sectors for request
|
|
|
+ * @limits: the queue limits
|
|
|
+ * @max_hw_sectors: max hardware sectors in the usual 512b unit
|
|
|
+ *
|
|
|
+ * Description:
|
|
|
+ * Enables a low level driver to set a hard upper limit,
|
|
|
+ * max_hw_sectors, on the size of requests. max_hw_sectors is set by
|
|
|
+ * the device driver based upon the combined capabilities of I/O
|
|
|
+ * controller and storage device.
|
|
|
+ *
|
|
|
+ * max_sectors is a soft limit imposed by the block layer for
|
|
|
+ * filesystem type requests. This value can be overridden on a
|
|
|
+ * per-device basis in /sys/block/<device>/queue/max_sectors_kb.
|
|
|
+ * The soft limit can not exceed max_hw_sectors.
|
|
|
+ **/
|
|
|
+void blk_limits_max_hw_sectors(struct queue_limits *limits, unsigned int max_hw_sectors)
|
|
|
+{
|
|
|
+ if ((max_hw_sectors << 9) < PAGE_CACHE_SIZE) {
|
|
|
+ max_hw_sectors = 1 << (PAGE_CACHE_SHIFT - 9);
|
|
|
+ printk(KERN_INFO "%s: set to minimum %d\n",
|
|
|
+ __func__, max_hw_sectors);
|
|
|
+ }
|
|
|
+
|
|
|
+ limits->max_hw_sectors = max_hw_sectors;
|
|
|
+ limits->max_sectors = min_t(unsigned int, max_hw_sectors,
|
|
|
+ BLK_DEF_MAX_SECTORS);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(blk_limits_max_hw_sectors);
|
|
|
+
|
|
|
+/**
|
|
|
+ * blk_queue_max_hw_sectors - set max sectors for a request for this queue
|
|
|
+ * @q: the request queue for the device
|
|
|
+ * @max_hw_sectors: max hardware sectors in the usual 512b unit
|
|
|
+ *
|
|
|
+ * Description:
|
|
|
+ * See description for blk_limits_max_hw_sectors().
|
|
|
+ **/
|
|
|
+void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors)
|
|
|
+{
|
|
|
+ blk_limits_max_hw_sectors(&q->limits, max_hw_sectors);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(blk_queue_max_hw_sectors);
|
|
|
+
|
|
|
+/**
|
|
|
+ * blk_queue_max_discard_sectors - set max sectors for a single discard
|
|
|
+ * @q: the request queue for the device
|
|
|
+ * @max_discard_sectors: maximum number of sectors to discard
|
|
|
+ **/
|
|
|
+void blk_queue_max_discard_sectors(struct request_queue *q,
|
|
|
+ unsigned int max_discard_sectors)
|
|
|
+{
|
|
|
+ q->limits.max_discard_sectors = max_discard_sectors;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(blk_queue_max_discard_sectors);
|
|
|
+
|
|
|
+/**
|
|
|
+ * blk_queue_max_write_same_sectors - set max sectors for a single write same
|
|
|
+ * @q: the request queue for the device
|
|
|
+ * @max_write_same_sectors: maximum number of sectors to write per command
|
|
|
+ **/
|
|
|
+void blk_queue_max_write_same_sectors(struct request_queue *q,
|
|
|
+ unsigned int max_write_same_sectors)
|
|
|
+{
|
|
|
+ q->limits.max_write_same_sectors = max_write_same_sectors;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(blk_queue_max_write_same_sectors);
|
|
|
+
|
|
|
+/**
|
|
|
+ * blk_queue_max_segments - set max hw segments for a request for this queue
|
|
|
+ * @q: the request queue for the device
|
|
|
+ * @max_segments: max number of segments
|
|
|
+ *
|
|
|
+ * Description:
|
|
|
+ * Enables a low level driver to set an upper limit on the number of
|
|
|
+ * hw data segments in a request.
|
|
|
+ **/
|
|
|
+void blk_queue_max_segments(struct request_queue *q, unsigned short max_segments)
|
|
|
+{
|
|
|
+ if (!max_segments) {
|