From 24ecb0cb1555a5c82cb0c203e7f937a90ab07eae Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Wed, 2 Jan 2008 20:33:54 +0000 Subject: [PATCH] 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 --- sys/dev/ata/ata-disk.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 63a226c8172..bac091fd771 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;