diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-settings.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c index 78549c723783..605df9b3de8f 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -212,26 +212,30 @@ EXPORT_SYMBOL(blk_queue_bounce_limit); | |||
212 | /** | 212 | /** |
213 | * blk_queue_max_sectors - set max sectors for a request for this queue | 213 | * blk_queue_max_sectors - set max sectors for a request for this queue |
214 | * @q: the request queue for the device | 214 | * @q: the request queue for the device |
215 | * @max_sectors: max sectors in the usual 512b unit | 215 | * @max_hw_sectors: max hardware sectors in the usual 512b unit |
216 | * | 216 | * |
217 | * Description: | 217 | * Description: |
218 | * Enables a low level driver to set an upper limit on the size of | 218 | * Enables a low level driver to set a hard upper limit, |
219 | * received requests. | 219 | * max_hw_sectors, on the size of requests. max_hw_sectors is set by |
220 | * the device driver based upon the combined capabilities of I/O | ||
221 | * controller and storage device. | ||
222 | * | ||
223 | * max_sectors is a soft limit imposed by the block layer for | ||
224 | * filesystem type requests. This value can be overridden on a | ||
225 | * per-device basis in /sys/block/<device>/queue/max_sectors_kb. | ||
226 | * The soft limit can not exceed max_hw_sectors. | ||
220 | **/ | 227 | **/ |
221 | void blk_queue_max_sectors(struct request_queue *q, unsigned int max_sectors) | 228 | void blk_queue_max_sectors(struct request_queue *q, unsigned int max_hw_sectors) |
222 | { | 229 | { |
223 | if ((max_sectors << 9) < PAGE_CACHE_SIZE) { | 230 | if ((max_hw_sectors << 9) < PAGE_CACHE_SIZE) { |
224 | max_sectors = 1 << (PAGE_CACHE_SHIFT - 9); | 231 | max_hw_sectors = 1 << (PAGE_CACHE_SHIFT - 9); |
225 | printk(KERN_INFO "%s: set to minimum %d\n", | 232 | printk(KERN_INFO "%s: set to minimum %d\n", |
226 | __func__, max_sectors); | 233 | __func__, max_hw_sectors); |
227 | } | 234 | } |
228 | 235 | ||
229 | if (BLK_DEF_MAX_SECTORS > max_sectors) | 236 | q->limits.max_hw_sectors = max_hw_sectors; |
230 | q->limits.max_hw_sectors = q->limits.max_sectors = max_sectors; | 237 | q->limits.max_sectors = min_t(unsigned int, max_hw_sectors, |
231 | else { | 238 | BLK_DEF_MAX_SECTORS); |
232 | q->limits.max_sectors = BLK_DEF_MAX_SECTORS; | ||
233 | q->limits.max_hw_sectors = max_sectors; | ||
234 | } | ||
235 | } | 239 | } |
236 | EXPORT_SYMBOL(blk_queue_max_sectors); | 240 | EXPORT_SYMBOL(blk_queue_max_sectors); |
237 | 241 | ||