mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
e1defc4ff0
commit
ae03bf639a
25 changed files with 147 additions and 97 deletions
|
|
@ -219,6 +219,15 @@ void blk_queue_max_sectors(struct request_queue *q, unsigned int max_sectors)
|
|||
}
|
||||
EXPORT_SYMBOL(blk_queue_max_sectors);
|
||||
|
||||
void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_sectors)
|
||||
{
|
||||
if (BLK_DEF_MAX_SECTORS > max_sectors)
|
||||
q->max_hw_sectors = BLK_DEF_MAX_SECTORS;
|
||||
else
|
||||
q->max_hw_sectors = max_sectors;
|
||||
}
|
||||
EXPORT_SYMBOL(blk_queue_max_hw_sectors);
|
||||
|
||||
/**
|
||||
* blk_queue_max_phys_segments - set max phys segments for a request for this queue
|
||||
* @q: the request queue for the device
|
||||
|
|
@ -395,11 +404,11 @@ int blk_queue_dma_drain(struct request_queue *q,
|
|||
dma_drain_needed_fn *dma_drain_needed,
|
||||
void *buf, unsigned int size)
|
||||
{
|
||||
if (q->max_hw_segments < 2 || q->max_phys_segments < 2)
|
||||
if (queue_max_hw_segments(q) < 2 || queue_max_phys_segments(q) < 2)
|
||||
return -EINVAL;
|
||||
/* make room for appending the drain */
|
||||
--q->max_hw_segments;
|
||||
--q->max_phys_segments;
|
||||
blk_queue_max_hw_segments(q, queue_max_hw_segments(q) - 1);
|
||||
blk_queue_max_phys_segments(q, queue_max_phys_segments(q) - 1);
|
||||
q->dma_drain_needed = dma_drain_needed;
|
||||
q->dma_drain_buffer = buf;
|
||||
q->dma_drain_size = size;
|
||||
|
|
|
|||
Loading…
Reference in a new issue