summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2009-07-31 11:49:11 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-08-01 10:24:35 +0200
commit7c958e32649e0c35801762878fb0b6da8c55a515 (patch)
tree610b1e685b5f634ca591865cc9f5ce22f1e3e6c1 /block
parentfef246672b009cf3f7a74e2fc9a76932ef2eeed2 (diff)
downloadlinux-stable-7c958e32649e0c35801762878fb0b6da8c55a515.tar.gz
linux-stable-7c958e32649e0c35801762878fb0b6da8c55a515.tar.bz2
linux-stable-7c958e32649e0c35801762878fb0b6da8c55a515.zip
block: Add a wrapper for setting minimum request size without a queue
Introduce blk_limits_io_min() and make blk_queue_io_min() call it. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-settings.c31
1 files changed, 24 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)
EXPORT_SYMBOL(blk_queue_alignment_offset);
/**
+ * blk_limits_io_min - set minimum request size for a device
+ * @limits: the queue limits
+ * @min: smallest I/O size in bytes
+ *
+ * Description:
+ * Some devices have an internal block size bigger than the reported
+ * hardware sector size. This function can be used to signal the
+ * smallest I/O the device can perform without incurring a performance
+ * penalty.
+ */
+void blk_limits_io_min(struct queue_limits *limits, unsigned int min)
+{
+ limits->io_min = min;
+
+ if (limits->io_min < limits->logical_block_size)
+ limits->io_min = limits->logical_block_size;
+
+ if (limits->io_min < limits->physical_block_size)
+ limits->io_min = limits->physical_block_size;
+}
+EXPORT_SYMBOL(blk_limits_io_min);
+
+/**
* blk_queue_io_min - set minimum request size for the queue
* @q: the request queue for the device
* @min: smallest I/O size in bytes
@@ -396,13 +419,7 @@ EXPORT_SYMBOL(blk_queue_alignment_offset);
*/
void blk_queue_io_min(struct request_queue *q, unsigned int min)
{
- q->limits.io_min = min;
-
- if (q->limits.io_min < q->limits.logical_block_size)
- q->limits.io_min = q->limits.logical_block_size;
-
- if (q->limits.io_min < q->limits.physical_block_size)
- q->limits.io_min = q->limits.physical_block_size;
+ blk_limits_io_min(&q->limits, min);
}
EXPORT_SYMBOL(blk_queue_io_min);