diff options
-rw-r--r-- | block/blk-settings.c | 31 | ||||
-rw-r--r-- | include/linux/blkdev.h | 1 |
2 files changed, 25 insertions, 7 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c index 8e86e2d2b147..1f7197434166 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -384,6 +384,29 @@ void blk_queue_alignment_offset(struct request_queue *q, unsigned int offset) | |||
384 | EXPORT_SYMBOL(blk_queue_alignment_offset); | 384 | EXPORT_SYMBOL(blk_queue_alignment_offset); |
385 | 385 | ||
386 | /** | 386 | /** |
387 | * blk_limits_io_min - set minimum request size for a device | ||
388 | * @limits: the queue limits | ||
389 | * @min: smallest I/O size in bytes | ||
390 | * | ||
391 | * Description: | ||
392 | * Some devices have an internal block size bigger than the reported | ||
393 | * hardware sector size. This function can be used to signal the | ||
394 | * smallest I/O the device can perform without incurring a performance | ||
395 | * penalty. | ||
396 | */ | ||
397 | void blk_limits_io_min(struct queue_limits *limits, unsigned int min) | ||
398 | { | ||
399 | limits->io_min = min; | ||
400 | |||
401 | if (limits->io_min < limits->logical_block_size) | ||
402 | limits->io_min = limits->logical_block_size; | ||
403 | |||
404 | if (limits->io_min < limits->physical_block_size) | ||
405 | limits->io_min = limits->physical_block_size; | ||
406 | } | ||
407 | EXPORT_SYMBOL(blk_limits_io_min); | ||
408 | |||
409 | /** | ||
387 | * blk_queue_io_min - set minimum request size for the queue | 410 | * blk_queue_io_min - set minimum request size for the queue |
388 | * @q: the request queue for the device | 411 | * @q: the request queue for the device |
389 | * @min: smallest I/O size in bytes | 412 | * @min: smallest I/O size in bytes |
@@ -396,13 +419,7 @@ EXPORT_SYMBOL(blk_queue_alignment_offset); | |||
396 | */ | 419 | */ |
397 | void blk_queue_io_min(struct request_queue *q, unsigned int min) | 420 | void blk_queue_io_min(struct request_queue *q, unsigned int min) |
398 | { | 421 | { |
399 | q->limits.io_min = min; | 422 | blk_limits_io_min(&q->limits, min); |
400 | |||
401 | if (q->limits.io_min < q->limits.logical_block_size) | ||
402 | q->limits.io_min = q->limits.logical_block_size; | ||
403 | |||
404 | if (q->limits.io_min < q->limits.physical_block_size) | ||
405 | q->limits.io_min = q->limits.physical_block_size; | ||
406 | } | 423 | } |
407 | EXPORT_SYMBOL(blk_queue_io_min); | 424 | EXPORT_SYMBOL(blk_queue_io_min); |
408 | 425 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index e7cb5dbf6c26..69103e053c92 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -913,6 +913,7 @@ extern void blk_queue_logical_block_size(struct request_queue *, unsigned short) | |||
913 | extern void blk_queue_physical_block_size(struct request_queue *, unsigned short); | 913 | extern void blk_queue_physical_block_size(struct request_queue *, unsigned short); |
914 | extern void blk_queue_alignment_offset(struct request_queue *q, | 914 | extern void blk_queue_alignment_offset(struct request_queue *q, |
915 | unsigned int alignment); | 915 | unsigned int alignment); |
916 | extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min); | ||
916 | extern void blk_queue_io_min(struct request_queue *q, unsigned int min); | 917 | extern void blk_queue_io_min(struct request_queue *q, unsigned int min); |
917 | extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); | 918 | extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); |
918 | extern void blk_set_default_limits(struct queue_limits *lim); | 919 | extern void blk_set_default_limits(struct queue_limits *lim); |