summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2009-05-23 11:43:39 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-06-21 10:52:38 -0500
commitd11b6916961d6ec7d7215332cbbe9feec086721d (patch)
tree152bdf47fbf1cc1604e79748655dfddfe8f74ce7 /drivers/scsi/sd.c
parent3821d768912a47ddbd6cab52943a8284df88003c (diff)
downloadop-kernel-dev-d11b6916961d6ec7d7215332cbbe9feec086721d.zip
op-kernel-dev-d11b6916961d6ec7d7215332cbbe9feec086721d.tar.gz
sd: Block limits VPD support
Query the block limits VPD page and adjust queue minimum and optimal I/O sizes. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 2148d65..e4ef11a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1795,6 +1795,29 @@ void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)
}
/**
+ * sd_read_block_limits - Query disk device for preferred I/O sizes.
+ * @disk: disk to query
+ */
+static void sd_read_block_limits(struct scsi_disk *sdkp)
+{
+ unsigned int sector_sz = sdkp->device->sector_size;
+ char *buffer;
+
+ /* Block Limits VPD */
+ buffer = scsi_get_vpd_page(sdkp->device, 0xb0);
+
+ if (buffer == NULL)
+ return;
+
+ blk_queue_io_min(sdkp->disk->queue,
+ get_unaligned_be16(&buffer[6]) * sector_sz);
+ blk_queue_io_opt(sdkp->disk->queue,
+ get_unaligned_be32(&buffer[12]) * sector_sz);
+
+ kfree(buffer);
+}
+
+/**
* sd_read_block_characteristics - Query block dev. characteristics
* @disk: disk to query
*/
@@ -1854,6 +1877,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
*/
if (sdkp->media_present) {
sd_read_capacity(sdkp, buffer);
+ sd_read_block_limits(sdkp);
sd_read_block_characteristics(sdkp);
sd_read_write_protect_flag(sdkp, buffer);
sd_read_cache_type(sdkp, buffer);
OpenPOWER on IntegriCloud