libata: set queue SSD flag for SSD devices
authorJens Axboe <jens.axboe@oracle.com>
Wed, 24 Sep 2008 11:05:10 +0000 (13:05 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 9 Oct 2008 06:56:19 +0000 (08:56 +0200)
SSD devices should give an RPM setting of 1 in word 217 of the ID
page. If we see such a device, tell the block layer about it.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
drivers/ata/libata-scsi.c
include/linux/ata.h

index b9d3ba423cb2d30eefc17bb349bee2376f624343..054370700abf555d62e9ecae3e4c6d0fa81c3e2d 100644 (file)
@@ -977,6 +977,10 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
 
                blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN);
        } else {
+               if (ata_id_is_ssd(dev->id))
+                       queue_flag_set_unlocked(QUEUE_FLAG_NONROT,
+                                               sdev->request_queue);
+
                /* ATA devices must be sector aligned */
                blk_queue_update_dma_alignment(sdev->request_queue,
                                               ATA_SECT_SIZE - 1);
index 8a12d718c16931892d7842a9e6e3c3e6020b2443..c1c8b4a4ba26d02ba72dea781cae492a8d4a436d 100644 (file)
@@ -88,6 +88,7 @@ enum {
        ATA_ID_DLF              = 128,
        ATA_ID_CSFO             = 129,
        ATA_ID_CFA_POWER        = 160,
+       ATA_ID_ROT_SPEED        = 217,
        ATA_ID_PIO4             = (1 << 1),
 
        ATA_ID_SERNO_LEN        = 20,
@@ -691,6 +692,11 @@ static inline int ata_id_is_cfa(const u16 *id)
        return 0;
 }
 
+static inline int ata_id_is_ssd(const u16 *id)
+{
+       return id[ATA_ID_ROT_SPEED] == 0x01;
+}
+
 static inline int ata_drive_40wire(const u16 *dev_id)
 {
        if (ata_id_is_sata(dev_id))
This page took 0.031757 seconds and 5 git commands to generate.