freebsd-src/sys/cam/scsi
Justin T. Gibbs f03f7a0ca3 Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic.
Add the BIO_ORDERED flag for struct bio and update bio clients to use it.

The barrier semantics of bioq_insert_tail() were broken in two ways:

 o In bioq_disksort(), an added bio could be inserted at the head of
   the queue, even when a barrier was present, if the sort key for
   the new entry was less than that of the last queued barrier bio.

 o The last_offset used to generate the sort key for newly queued bios
   did not stay at the position of the barrier until either the
   barrier was de-queued, or a new barrier (which updates last_offset)
   was queued.  When a barrier is in effect, we know that the disk
   will pass through the barrier position just before the
   "blocked bios" are released, so using the barrier's offset for
   last_offset is the optimal choice.

sys/geom/sched/subr_disk.c:
sys/kern/subr_disk.c:
	o Update last_offset in bioq_insert_tail().

	o Only update last_offset in bioq_remove() if the removed bio is
	  at the head of the queue (typically due to a call via
	  bioq_takefirst()) and no barrier is active.

	o In bioq_disksort(), if we have a barrier (insert_point is non-NULL),
	  set prev to the barrier and cur to it's next element.  Now that
	  last_offset is kept at the barrier position, this change isn't
	  strictly necessary, but since we have to take a decision branch
	  anyway, it does avoid one, no-op, loop iteration in the while
	  loop that immediately follows.

	o In bioq_disksort(), bypass the normal sort for bios with the
	  BIO_ORDERED attribute and instead insert them into the queue
	  with bioq_insert_tail().  bioq_insert_tail() not only gives
	  the desired command order during insertion, but also provides
	  barrier semantics so that commands disksorted in the future
	  cannot pass the just enqueued transaction.

sys/sys/bio.h:
	Add BIO_ORDERED as bit 4 of the bio_flags field in struct bio.

sys/cam/ata/ata_da.c:
sys/cam/scsi/scsi_da.c
	Use an ordered command for SCSI/ATA-NCQ commands issued in
	response to bios with the BIO_ORDERED flag set.

sys/cam/scsi/scsi_da.c
	Use an ordered tag when issuing a synchronize cache command.

	Wrap some lines to 80 columns.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
sys/geom/geom_io.c
	Mark bios with the BIO_FLUSH command as BIO_ORDERED.

Sponsored by:	Spectra Logic Corporation
MFC after:	1 month
2010-09-02 19:40:28 +00:00
..
scsi_all.c Make additional definitions up to and including SPC-4. Add in definitions 2010-06-08 05:14:18 +00:00
scsi_all.h For the target port groups structures, don't allocate the initial element. 2010-06-14 22:02:18 +00:00
scsi_cd.c Export PCI IDs of ATA/SATA controllers through CAM and ata(4) layers to 2010-07-25 15:43:52 +00:00
scsi_cd.h
scsi_ch.c MFp4: Large set of CAM inprovements. 2010-01-28 08:41:30 +00:00
scsi_ch.h Make additional definitions up to and including SPC-4. Add in definitions 2010-06-08 05:14:18 +00:00
scsi_da.c Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic. 2010-09-02 19:40:28 +00:00
scsi_da.h
scsi_dvcfg.h
scsi_iu.h
scsi_low.c MFp4: Large set of CAM inprovements. 2010-01-28 08:41:30 +00:00
scsi_low.h Add a new 'why' argument to kdb_enter(), and a set of constants to use 2007-12-25 17:52:02 +00:00
scsi_low_pisa.c
scsi_low_pisa.h
scsi_message.h
scsi_pass.c MFp4: Large set of CAM inprovements. 2010-01-28 08:41:30 +00:00
scsi_pass.h
scsi_pt.c Replace most of priority numbers with defines. No logical changes. 2009-10-23 08:27:55 +00:00
scsi_pt.h
scsi_sa.c Replace most of priority numbers with defines. No logical changes. 2009-10-23 08:27:55 +00:00
scsi_sa.h
scsi_ses.c Remove extraneous semicolons, no functional changes. 2010-01-07 21:01:37 +00:00
scsi_ses.h Fix ioctl to not get swallowed by ioctl code (i.e., make sure the darned 2006-01-18 08:37:27 +00:00
scsi_sg.c Pick up the right change, not it's close cousin. The one 2010-05-11 22:51:13 +00:00
scsi_sg.h A fix for the SG_GET_TIMEOUT function slipped into a previous commit by 2007-04-10 20:03:42 +00:00
scsi_targ_bh.c Remove extraneous semicolons, no functional changes. 2010-01-07 21:01:37 +00:00
scsi_target.c Fix two (very common) occurrences of s/sytem/system in comments. 2010-08-02 18:06:49 +00:00
scsi_targetio.h
scsi_xpt.c Implement the usage of Report Luns as part of SCSI probing for SCP3 or 2010-06-08 16:17:25 +00:00