summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-10-31 21:19:25 +0000
committerpjd <pjd@FreeBSD.org>2006-10-31 21:19:25 +0000
commit4ed49f81f813686d8a7faf0c75dc006bb0632cf8 (patch)
treee7596b419a359a5488cd4aa3c109c1d642056b40 /sys/cam
parent67c00d09c15829fc438fdaf3ed5b6bb694301114 (diff)
downloadFreeBSD-src-4ed49f81f813686d8a7faf0c75dc006bb0632cf8.zip
FreeBSD-src-4ed49f81f813686d8a7faf0c75dc006bb0632cf8.tar.gz
Implement BIO_FLUSH handling for da(4), amr(4), ata(4) and ataraid(4).
Sponsored by: home.pl
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/scsi/scsi_da.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index e5dc32d..fc3692b 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -1179,6 +1179,8 @@ daregister(struct cam_periph *periph, void *arg)
softc->disk->d_maxsize = DFLTPHYS; /* XXX: probably not arbitrary */
softc->disk->d_unit = periph->unit_number;
softc->disk->d_flags = DISKFLAG_NEEDSGIANT;
+ if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0)
+ softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
disk_create(softc->disk, DISK_VERSION);
/*
@@ -1250,20 +1252,35 @@ dastart(struct cam_periph *periph, union ccb *start_ccb)
} else {
tag_code = MSG_SIMPLE_Q_TAG;
}
- scsi_read_write(&start_ccb->csio,
- /*retries*/da_retry_count,
- /*cbfcnp*/dadone,
- /*tag_action*/tag_code,
- /*read_op*/bp->bio_cmd == BIO_READ,
- /*byte2*/0,
- softc->minimum_cmd_size,
- /*lba*/bp->bio_pblkno,
- /*block_count*/bp->bio_bcount /
- softc->params.secsize,
- /*data_ptr*/ bp->bio_data,
- /*dxfer_len*/ bp->bio_bcount,
- /*sense_len*/SSD_FULL_SIZE,
- /*timeout*/da_default_timeout*1000);
+ switch (bp->bio_cmd) {
+ case BIO_READ:
+ case BIO_WRITE:
+ scsi_read_write(&start_ccb->csio,
+ /*retries*/da_retry_count,
+ /*cbfcnp*/dadone,
+ /*tag_action*/tag_code,
+ /*read_op*/bp->bio_cmd == BIO_READ,
+ /*byte2*/0,
+ softc->minimum_cmd_size,
+ /*lba*/bp->bio_pblkno,
+ /*block_count*/bp->bio_bcount /
+ softc->params.secsize,
+ /*data_ptr*/ bp->bio_data,
+ /*dxfer_len*/ bp->bio_bcount,
+ /*sense_len*/SSD_FULL_SIZE,
+ /*timeout*/da_default_timeout*1000);
+ break;
+ case BIO_FLUSH:
+ scsi_synchronize_cache(&start_ccb->csio,
+ /*retries*/1,
+ /*cbfcnp*/dadone,
+ MSG_SIMPLE_Q_TAG,
+ /*begin_lba*/0,/* Cover the whole disk */
+ /*lb_count*/0,
+ SSD_FULL_SIZE,
+ /*timeout*/da_default_timeout*1000);
+ break;
+ }
start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO;
/*
OpenPOWER on IntegriCloud