aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2009-11-26 22:46:03 -0500
committerJeff Garzik <jgarzik@redhat.com>2009-12-03 18:01:04 -0500
commite78db4dfb1355a895f7ea50133b702b55b8ed184 (patch)
tree13052100a353857ff07dbb0a3c78fdc713e58bcb /drivers/ata
parentd413ff3e2aa09a4ebef718dbc4be4356f879467f (diff)
libata: Report zeroed read after TRIM and max discard size
Our current TRIM payload is a single sector that can accommodate 64 * 65535 blocks being unmapped. Report this value in the Block Limits Maximum Unmap LBA count field. If a storage device supports TRIM and the DRAT and RZAT bits are set, report TPRZ=1 in Read Capacity(16). Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-scsi.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 340a616d226b..e1e186b9dfcc 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2115,8 +2115,10 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
2115 * that we support some form of unmap - in thise case via WRITE SAME 2115 * that we support some form of unmap - in thise case via WRITE SAME
2116 * with the unmap bit set. 2116 * with the unmap bit set.
2117 */ 2117 */
2118 if (ata_id_has_trim(args->id)) 2118 if (ata_id_has_trim(args->id)) {
2119 put_unaligned_be32(65535 * 512 / 8, &rbuf[20]);
2119 put_unaligned_be32(1, &rbuf[28]); 2120 put_unaligned_be32(1, &rbuf[28]);
2121 }
2120 2122
2121 return 0; 2123 return 0;
2122} 2124}
@@ -2411,8 +2413,12 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
2411 rbuf[14] = (lowest_aligned >> 8) & 0x3f; 2413 rbuf[14] = (lowest_aligned >> 8) & 0x3f;
2412 rbuf[15] = lowest_aligned; 2414 rbuf[15] = lowest_aligned;
2413 2415
2414 if (ata_id_has_trim(args->id)) 2416 if (ata_id_has_trim(args->id)) {
2415 rbuf[14] |= 0x80; 2417 rbuf[14] |= 0x80; /* TPE */
2418
2419 if (ata_id_has_zero_after_trim(args->id))
2420 rbuf[14] |= 0x40; /* TPRZ */
2421 }
2416 } 2422 }
2417 2423
2418 return 0; 2424 return 0;