diff options
author | phk <phk@FreeBSD.org> | 2008-01-02 20:33:54 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2008-01-02 20:33:54 +0000 |
commit | 34e034ebc6ca1e6cb030e381b5f003c30215034e (patch) | |
tree | 081ab3a39a9e5ffda45e6dce1890351e6db7ba61 /sys/dev | |
parent | 340db3aed485c6e9710c7323db215f9b0aff6cfb (diff) | |
download | FreeBSD-src-34e034ebc6ca1e6cb030e381b5f003c30215034e.zip FreeBSD-src-34e034ebc6ca1e6cb030e381b5f003c30215034e.tar.gz |
If the disk reports that it support the Compact Flash Association command
set, announce BIO_DELETE capability and issue ATA_CFA_ERASE when we get one.
Once we issue more BIO_DELETE, this will improve lifetime, and
possibly write speed of Flash based devices which have usable flash
adaptation layers.
For now, about the only usage is the newfs(1) -E flag.
Approved by: sos
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/ata-disk.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 63a226c..bac091f 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -162,6 +162,9 @@ ad_attach(device_t dev) adp->disk->d_unit = device_get_unit(dev); if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) adp->disk->d_flags = DISKFLAG_CANFLUSHCACHE; + if ((atadev->param.support.command2 & ATA_SUPPORT_CFA) || + atadev->param.config == ATA_PROTO_CFA) + adp->disk->d_flags = DISKFLAG_CANDELETE; snprintf(adp->disk->d_ident, sizeof(adp->disk->d_ident), "ad:%s", atadev->param.serial); disk_create(adp->disk, DISK_VERSION); @@ -274,6 +277,12 @@ ad_strategy(struct bio *bp) else request->u.ata.command = ATA_WRITE; break; + case BIO_DELETE: + request->flags = ATA_R_CONTROL; + request->u.ata.command = ATA_CFA_ERASE; + request->transfersize = 0; + request->donecount = bp->bio_bcount; + break; case BIO_FLUSH: request->u.ata.lba = 0; request->u.ata.count = 0; |