aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-settings.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2009-05-22 17:17:50 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-22 17:22:54 -0400
commitae03bf639a5027d27270123f5f6e3ee6a412781d (patch)
treed705f41a188ad656b1f47f7952626a9f992e3b8f /block/blk-settings.c
parente1defc4ff0cf57aca6c5e3ff99fa503f5943c1f1 (diff)
block: Use accessor functions for queue limits
Convert all external users of queue limits to using wrapper functions instead of poking the request queue variables directly. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-settings.c')
-rw-r--r--block/blk-settings.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 15c3164537b8..0b32f984eed2 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -219,6 +219,15 @@ void blk_queue_max_sectors(struct request_queue *q, unsigned int max_sectors)
219} 219}
220EXPORT_SYMBOL(blk_queue_max_sectors); 220EXPORT_SYMBOL(blk_queue_max_sectors);
221 221
222void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_sectors)
223{
224 if (BLK_DEF_MAX_SECTORS > max_sectors)
225 q->max_hw_sectors = BLK_DEF_MAX_SECTORS;
226 else
227 q->max_hw_sectors = max_sectors;
228}
229EXPORT_SYMBOL(blk_queue_max_hw_sectors);
230
222/** 231/**
223 * blk_queue_max_phys_segments - set max phys segments for a request for this queue 232 * blk_queue_max_phys_segments - set max phys segments for a request for this queue
224 * @q: the request queue for the device 233 * @q: the request queue for the device
@@ -395,11 +404,11 @@ int blk_queue_dma_drain(struct request_queue *q,
395 dma_drain_needed_fn *dma_drain_needed, 404 dma_drain_needed_fn *dma_drain_needed,
396 void *buf, unsigned int size) 405 void *buf, unsigned int size)
397{ 406{
398 if (q->max_hw_segments < 2 || q->max_phys_segments < 2) 407 if (queue_max_hw_segments(q) < 2 || queue_max_phys_segments(q) < 2)
399 return -EINVAL; 408 return -EINVAL;
400 /* make room for appending the drain */ 409 /* make room for appending the drain */
401 --q->max_hw_segments; 410 blk_queue_max_hw_segments(q, queue_max_hw_segments(q) - 1);
402 --q->max_phys_segments; 411 blk_queue_max_phys_segments(q, queue_max_phys_segments(q) - 1);
403 q->dma_drain_needed = dma_drain_needed; 412 q->dma_drain_needed = dma_drain_needed;
404 q->dma_drain_buffer = buf; 413 q->dma_drain_buffer = buf;
405 q->dma_drain_size = size; 414 q->dma_drain_size = size;