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
This commit is contained in:
Poul-Henning Kamp 2008-01-02 20:33:54 +00:00
parent 08d2425f6f
commit 24ecb0cb15

View file

@ -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;