Module Name: src Committed By: jdolecek Date: Wed Oct 24 19:46:44 UTC 2018
Modified Files: src/sys/dev/ata: TODO.ncq wd.c Log Message: move the comment (and expand) about NCQ TRIM to wd_trim() To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ata/TODO.ncq cvs rdiff -u -r1.442 -r1.443 src/sys/dev/ata/wd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ata/TODO.ncq diff -u src/sys/dev/ata/TODO.ncq:1.11 src/sys/dev/ata/TODO.ncq:1.12 --- src/sys/dev/ata/TODO.ncq:1.11 Wed Oct 24 19:38:00 2018 +++ src/sys/dev/ata/TODO.ncq Wed Oct 24 19:46:44 2018 @@ -12,5 +12,3 @@ set - not easy to fix, open needs to read disklabel and all this mechanics is too much for emergency crash dump code path - old bug - kern/16789 - -add support for the NCQ TRIM if supported by device? Index: src/sys/dev/ata/wd.c diff -u src/sys/dev/ata/wd.c:1.442 src/sys/dev/ata/wd.c:1.443 --- src/sys/dev/ata/wd.c:1.442 Mon Oct 22 20:13:47 2018 +++ src/sys/dev/ata/wd.c Wed Oct 24 19:46:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.442 2018/10/22 20:13:47 jdolecek Exp $ */ +/* $NetBSD: wd.c,v 1.443 2018/10/24 19:46:44 jdolecek Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -54,7 +54,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.442 2018/10/22 20:13:47 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.443 2018/10/24 19:46:44 jdolecek Exp $"); #include "opt_ata.h" #include "opt_wd.h" @@ -1819,6 +1819,9 @@ out_xfer: return error; } +/* + * Execute TRIM command, assumes sleep context. + */ static int wd_trim(struct wd_softc *wd, daddr_t bno, long size) { @@ -1839,6 +1842,14 @@ wd_trim(struct wd_softc *wd, daddr_t bno req[6] = size & 0xff; req[7] = (size >> 8) & 0xff; + /* + * XXX We could possibly use NCQ TRIM, which supports executing + * this command concurrently. It would need some investigation, some + * early or not so early disk firmware caused data loss with NCQ TRIM. + * atastart() et.al would need to be adjusted to allow and support + * running several non-I/O ATA commands in parallel. + */ + xfer->c_ata_c.r_command = ATA_DATA_SET_MANAGEMENT; xfer->c_ata_c.r_count = 1; xfer->c_ata_c.r_features = ATA_SUPPORT_DSM_TRIM;