aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2009-05-23 11:43:38 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-06-21 11:52:38 -0400
commit3821d768912a47ddbd6cab52943a8284df88003c (patch)
treef4097861eae7aa84b8accf2a2da34d173207c8a0 /drivers/scsi
parentea09bcc9c298d3057270abd78a973fc678d55c4c (diff)
sd: Detect non-rotational devices
Detect non-rotational devices and set the queue flag accordingly. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sd.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a86064b6458d..2148d659c281 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_characteristics - Query block dev. characteristics
1799 * @disk: disk to query
1800 */
1801static void sd_read_block_characteristics(struct scsi_disk *sdkp)
1802{
1803 char *buffer;
1804 u16 rot;
1805
1806 /* Block Device Characteristics VPD */
1807 buffer = scsi_get_vpd_page(sdkp->device, 0xb1);
1808
1809 if (buffer == NULL)
1810 return;
1811
1812 rot = get_unaligned_be16(&buffer[4]);
1813
1814 if (rot == 1)
1815 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, sdkp->disk->queue);
1816
1817 kfree(buffer);
1818}
1819
1820/**
1798 * sd_revalidate_disk - called the first time a new disk is seen, 1821 * sd_revalidate_disk - called the first time a new disk is seen,
1799 * performs disk spin up, read_capacity, etc. 1822 * performs disk spin up, read_capacity, etc.
1800 * @disk: struct gendisk we care about 1823 * @disk: struct gendisk we care about
@@ -1831,6 +1854,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
1831 */ 1854 */
1832 if (sdkp->media_present) { 1855 if (sdkp->media_present) {
1833 sd_read_capacity(sdkp, buffer); 1856 sd_read_capacity(sdkp, buffer);
1857 sd_read_block_characteristics(sdkp);
1834 sd_read_write_protect_flag(sdkp, buffer); 1858 sd_read_write_protect_flag(sdkp, buffer);
1835 sd_read_cache_type(sdkp, buffer); 1859 sd_read_cache_type(sdkp, buffer);
1836 sd_read_app_tag_own(sdkp, buffer); 1860 sd_read_app_tag_own(sdkp, buffer);
@@ -1953,6 +1977,8 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
1953 add_disk(gd); 1977 add_disk(gd);
1954 sd_dif_config_host(sdkp); 1978 sd_dif_config_host(sdkp);
1955 1979
1980 sd_revalidate_disk(gd);
1981
1956 sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", 1982 sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
1957 sdp->removable ? "removable " : ""); 1983 sdp->removable ? "removable " : "");
1958} 1984}