cvs commit: src/sbin/atacontrol atacontrol.c

Poul-Henning Kamp phk at phk.freebsd.dk
Sun Dec 16 13:26:14 PST 2007


In message <476596FE.1090502 at FreeBSD.org>, "Bruce M. Simpson" writes:

>>   Modified files:
>>     sbin/atacontrol      atacontrol.c 
>>   Log:
>>   Recognize CFA devices using either identification method.
>
>Does this give the ata driver a means of identifying that a disk device 
>is actually a CompactFlash device?

I have the attached patch in sos@ mailbox for approval, that adds
BIO_DELETE support for the ata driver.

I also want to implement a -E option to fsck(8) to erase all
unallocated blocks.

And finally the big item: msdosfs and ufs support to issue BIO_DELETE
when files are deleted.  UFS is nasty because of soft-updates.

Poul-Henning

Index: ata-disk.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-disk.c,v
retrieving revision 1.205
diff -u -r1.205 ata-disk.c
--- ata-disk.c	23 Nov 2007 08:17:14 -0000	1.205
+++ ata-disk.c	16 Dec 2007 21:22:03 -0000
@@ -162,6 +162,9 @@
     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 @@
 	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;

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the cvs-all mailing list