diff options
author | Marc Carino <marc.ceeeee@gmail.com> | 2013-08-24 23:22:51 -0700 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-08-25 09:39:12 -0400 |
commit | 87fb6c31b9ef9ccab9a822b01fc3911f026a29bb (patch) | |
tree | cde77c63326f50564a45afefeffd0003db8ee8c7 /drivers/ata | |
parent | ed36911c747c18525691c0aa0fbe6b918c8eac19 (diff) | |
download | talos-op-linux-87fb6c31b9ef9ccab9a822b01fc3911f026a29bb.tar.gz talos-op-linux-87fb6c31b9ef9ccab9a822b01fc3911f026a29bb.zip |
libata: Add support for queued DSM TRIM
Some new SSDs support the queued version of the DSM TRIM command.
Let the driver use the new command if supported.
Signed-off-by: Marc Carino <marc.ceeeee@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-scsi.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index f177ad6bfd09..58026106fcd9 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -3097,12 +3097,25 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc) buf = page_address(sg_page(scsi_sglist(scmd))); size = ata_set_lba_range_entries(buf, 512, block, n_block); - tf->protocol = ATA_PROT_DMA; - tf->hob_feature = 0; - tf->feature = ATA_DSM_TRIM; - tf->hob_nsect = (size / 512) >> 8; - tf->nsect = size / 512; - tf->command = ATA_CMD_DSM; + if (ata_ncq_enabled(dev) && ata_fpdma_dsm_supported(dev)) { + /* Newer devices support queued TRIM commands */ + tf->protocol = ATA_PROT_NCQ; + tf->command = ATA_CMD_FPDMA_SEND; + tf->hob_nsect = ATA_SUBCMD_FPDMA_SEND_DSM & 0x1f; + tf->nsect = qc->tag << 3; + tf->hob_feature = (size / 512) >> 8; + tf->feature = size / 512; + + tf->auxiliary = 1; + } else { + tf->protocol = ATA_PROT_DMA; + tf->hob_feature = 0; + tf->feature = ATA_DSM_TRIM; + tf->hob_nsect = (size / 512) >> 8; + tf->nsect = size / 512; + tf->command = ATA_CMD_DSM; + } + tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48 | ATA_TFLAG_WRITE; |