diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2009-05-23 11:43:39 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-21 11:52:38 -0400 |
commit | d11b6916961d6ec7d7215332cbbe9feec086721d (patch) | |
tree | 152bdf47fbf1cc1604e79748655dfddfe8f74ce7 /drivers/scsi/sd.c | |
parent | 3821d768912a47ddbd6cab52943a8284df88003c (diff) |
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.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 2148d659c281..e4ef11af18a2 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) | |||
1795 | } | 1795 | } |
1796 | 1796 | ||
1797 | /** | 1797 | /** |
1798 | * sd_read_block_limits - Query disk device for preferred I/O sizes. | ||
1799 | * @disk: disk to query | ||
1800 | */ | ||
1801 | static void sd_read_block_limits(struct scsi_disk *sdkp) | ||
1802 | { | ||
1803 | unsigned int sector_sz = sdkp->device->sector_size; | ||
1804 | char *buffer; | ||
1805 | |||
1806 | /* Block Limits VPD */ | ||
1807 | buffer = scsi_get_vpd_page(sdkp->device, 0xb0); | ||
1808 | |||
1809 | if (buffer == NULL) | ||
1810 | return; | ||
1811 | |||
1812 | blk_queue_io_min(sdkp->disk->queue, | ||
1813 | get_unaligned_be16(&buffer[6]) * sector_sz); | ||
1814 | blk_queue_io_opt(sdkp->disk->queue, | ||
1815 | get_unaligned_be32(&buffer[12]) * sector_sz); | ||
1816 | |||
1817 | kfree(buffer); | ||
1818 | } | ||
1819 | |||
1820 | /** | ||
1798 | * sd_read_block_characteristics - Query block dev. characteristics | 1821 | * sd_read_block_characteristics - Query block dev. characteristics |
1799 | * @disk: disk to query | 1822 | * @disk: disk to query |
1800 | */ | 1823 | */ |
@@ -1854,6 +1877,7 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
1854 | */ | 1877 | */ |
1855 | if (sdkp->media_present) { | 1878 | if (sdkp->media_present) { |
1856 | sd_read_capacity(sdkp, buffer); | 1879 | sd_read_capacity(sdkp, buffer); |
1880 | sd_read_block_limits(sdkp); | ||
1857 | sd_read_block_characteristics(sdkp); | 1881 | sd_read_block_characteristics(sdkp); |
1858 | sd_read_write_protect_flag(sdkp, buffer); | 1882 | sd_read_write_protect_flag(sdkp, buffer); |
1859 | sd_read_cache_type(sdkp, buffer); | 1883 | sd_read_cache_type(sdkp, buffer); |