aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-settings.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2012-01-11 10:27:11 -0500
committerJens Axboe <axboe@kernel.dk>2012-01-11 10:27:11 -0500
commitb1bd055d397e09f99dcef9b138ed104ff1812fcb (patch)
treee8e1d3d0b6a33859392bcba516933aff256dc4b4 /block/blk-settings.c
parentc98b2cc29af8e84e7364b53e9bb4cc7cfaf62555 (diff)
block: Introduce blk_set_stacking_limits function
Stacking driver queue limits are typically bounded exclusively by the capabilities of the low level devices, not by the stacking driver itself. This patch introduces blk_set_stacking_limits() which has more liberal metrics than the default queue limits function. This allows us to inherit topology parameters from bottom devices without manually tweaking the default limits in each driver prior to calling the stacking function. Since there is now a clear distinction between stacking and low-level devices, blk_set_default_limits() has been modified to carry the more conservative values that we used to manually set in blk_queue_make_request(). Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-settings.c')
-rw-r--r--block/blk-settings.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c
index fa1eb0449a05..d3234fc494ad 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -104,9 +104,7 @@ EXPORT_SYMBOL_GPL(blk_queue_lld_busy);
104 * @lim: the queue_limits structure to reset 104 * @lim: the queue_limits structure to reset
105 * 105 *
106 * Description: 106 * Description:
107 * Returns a queue_limit struct to its default state. Can be used by 107 * Returns a queue_limit struct to its default state.
108 * stacking drivers like DM that stage table swaps and reuse an
109 * existing device queue.
110 */ 108 */
111void blk_set_default_limits(struct queue_limits *lim) 109void blk_set_default_limits(struct queue_limits *lim)
112{ 110{
@@ -114,13 +112,12 @@ void blk_set_default_limits(struct queue_limits *lim)
114 lim->max_integrity_segments = 0; 112 lim->max_integrity_segments = 0;
115 lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK; 113 lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;
116 lim->max_segment_size = BLK_MAX_SEGMENT_SIZE; 114 lim->max_segment_size = BLK_MAX_SEGMENT_SIZE;
117 lim->max_sectors = BLK_DEF_MAX_SECTORS; 115 lim->max_sectors = lim->max_hw_sectors = BLK_SAFE_MAX_SECTORS;
118 lim->max_hw_sectors = INT_MAX;
119 lim->max_discard_sectors = 0; 116 lim->max_discard_sectors = 0;
120 lim->discard_granularity = 0; 117 lim->discard_granularity = 0;
121 lim->discard_alignment = 0; 118 lim->discard_alignment = 0;
122 lim->discard_misaligned = 0; 119 lim->discard_misaligned = 0;
123 lim->discard_zeroes_data = 1; 120 lim->discard_zeroes_data = 0;
124 lim->logical_block_size = lim->physical_block_size = lim->io_min = 512; 121 lim->logical_block_size = lim->physical_block_size = lim->io_min = 512;
125 lim->bounce_pfn = (unsigned long)(BLK_BOUNCE_ANY >> PAGE_SHIFT); 122 lim->bounce_pfn = (unsigned long)(BLK_BOUNCE_ANY >> PAGE_SHIFT);
126 lim->alignment_offset = 0; 123 lim->alignment_offset = 0;
@@ -131,6 +128,27 @@ void blk_set_default_limits(struct queue_limits *lim)
131EXPORT_SYMBOL(blk_set_default_limits); 128EXPORT_SYMBOL(blk_set_default_limits);
132 129
133/** 130/**
131 * blk_set_stacking_limits - set default limits for stacking devices
132 * @lim: the queue_limits structure to reset
133 *
134 * Description:
135 * Returns a queue_limit struct to its default state. Should be used
136 * by stacking drivers like DM that have no internal limits.
137 */
138void blk_set_stacking_limits(struct queue_limits *lim)
139{
140 blk_set_default_limits(lim);
141
142 /* Inherit limits from component devices */
143 lim->discard_zeroes_data = 1;
144 lim->max_segments = USHRT_MAX;
145 lim->max_hw_sectors = UINT_MAX;
146
147 lim->max_sectors = BLK_DEF_MAX_SECTORS;
148}
149EXPORT_SYMBOL(blk_set_stacking_limits);
150
151/**
134 * blk_queue_make_request - define an alternate make_request function for a device 152 * blk_queue_make_request - define an alternate make_request function for a device
135 * @q: the request queue for the device to be affected 153 * @q: the request queue for the device to be affected
136 * @mfn: the alternate make_request function 154 * @mfn: the alternate make_request function
@@ -165,8 +183,6 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
165 q->nr_batching = BLK_BATCH_REQ; 183 q->nr_batching = BLK_BATCH_REQ;
166 184
167 blk_set_default_limits(&q->limits); 185 blk_set_default_limits(&q->limits);
168 blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS);
169 q->limits.discard_zeroes_data = 0;
170 186
171 /* 187 /*
172 * by default assume old behaviour and bounce for any highmem page 188 * by default assume old behaviour and bounce for any highmem page