summaryrefslogtreecommitdiffstats
path: root/sys/sys
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2009-12-28 20:08:01 +0000
committermav <mav@FreeBSD.org>2009-12-28 20:08:01 +0000
commitf60568ce2e9a52bcb63e2ad46f8bc34bf16b6273 (patch)
tree19ac67f810c8b99485f8cc69f04ff987d83ce637 /sys/sys
parent504913dcc8db18d78e4d44060377ba5ffe9f99b1 (diff)
downloadFreeBSD-src-f60568ce2e9a52bcb63e2ad46f8bc34bf16b6273.zip
FreeBSD-src-f60568ce2e9a52bcb63e2ad46f8bc34bf16b6273.tar.gz
Add BIO_DELETE support to ada(4):
- For SSDs use TRIM feature of DATA SET MANAGEMENT command, as defined by ACS-2 specification working draft. - For CompactFlash use CFA ERASE command, same as ad(4) does. With this patch, `newfs -E /dev/ada1` was able to restore write speed of my heavily weared OCZ Vertex SSD (firmware 1.4) up to the initial level for the most part of it's capacity. Previous 1.3 firmware, even reportiong TRIM capabilty bit set, was not working, reporting ABORT error for every DSM command. I have no idea whether it is normal, but for some reason it takes 200ms to handle any TRIM command on this drive, that was making delete extremely slow. But TRIM command is able to accept long list of LBAs and the length of that list seems doesn't affect it's execution time. Implemented request clusting algorithm allowed me to rise delete rate up to reasonable numbers, when many parallel DELETE requests running.
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/ata.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/sys/ata.h b/sys/sys/ata.h
index 91afb52..fab5e38 100644
--- a/sys/sys/ata.h
+++ b/sys/sys/ata.h
@@ -101,7 +101,9 @@ struct ata_params {
/*066*/ u_int16_t mwdmarec; /* rec. M/W DMA time ns */
/*067*/ u_int16_t pioblind; /* min. PIO cycle w/o flow */
/*068*/ u_int16_t pioiordy; /* min. PIO cycle IORDY flow */
- u_int16_t reserved69;
+/*069*/ u_int16_t support3;
+#define ATA_SUPPORT_RZAT 0x0020
+#define ATA_SUPPORT_DRAT 0x4000
u_int16_t reserved70;
/*071*/ u_int16_t rlsovlap; /* rel time (us) for overlap */
/*072*/ u_int16_t rlsservice; /* rel time (us) for service */
@@ -204,7 +206,8 @@ struct ata_params {
u_int16_t lba_size48_2;
u_int16_t lba_size48_3;
u_int16_t lba_size48_4;
- u_int16_t reserved104[2];
+ u_int16_t reserved104;
+/*105*/ u_int16_t max_dsm_blocks;
/*106*/ u_int16_t pss;
#define ATA_PSS_LSPPS 0x000F
#define ATA_PSS_LSSABOVE512 0x1000
@@ -230,7 +233,10 @@ struct ata_params {
/*162*/ u_int16_t cfa_kms_support;
/*163*/ u_int16_t cfa_trueide_modes;
/*164*/ u_int16_t cfa_memory_modes;
- u_int16_t reserved165[11];
+ u_int16_t reserved165[4];
+/*169*/ u_int16_t support_dsm;
+#define ATA_SUPPORT_DSM_TRIM 0x0001
+ u_int16_t reserved170[6];
/*176*/ u_int8_t media_serial[60];
/*206*/ u_int16_t sct;
u_int16_t reserved206[2];
@@ -284,6 +290,8 @@ struct ata_params {
#define ATA_NOP 0x00 /* NOP */
#define ATA_NF_FLUSHQUEUE 0x00 /* flush queued cmd's */
#define ATA_NF_AUTOPOLL 0x01 /* start autopoll function */
+#define ATA_DATA_SET_MANAGEMENT 0x06
+#define ATA_DSM_TRIM 0x01
#define ATA_DEVICE_RESET 0x08 /* reset device */
#define ATA_READ 0x20 /* read */
#define ATA_READ48 0x24 /* read 48bit LBA */
OpenPOWER on IntegriCloud