freebsd-skq/sys/geom
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
..
bde
cache Fixed cache size decoding read from a label. 2010-07-14 08:22:00 +00:00
concat Make geom_concat to passthrough stripe parameters of the first component, 2009-12-24 14:32:21 +00:00
eli Correct offset conversion to little endian. It was implemented in version 2, 2010-08-28 08:30:20 +00:00
gate 'unit' can be negative, so use signed type for it. 2010-06-14 21:58:55 +00:00
journal Make gjournal work with kernel compiled with "options DIAGNOSTIC". 2009-06-30 14:34:06 +00:00
label g_label: fix possible NULL pointer dereference 2010-05-31 09:10:39 +00:00
linux_lvm - Apply the same naming rules of LVM names as done in the LVM code itself. 2009-06-24 22:09:30 +00:00
mirror Remove bintime_cmp() function, unused since r200086. 2010-08-18 15:38:10 +00:00
mountver Make sure not to pass NULL to g_orphan_provider(). 2010-06-05 08:00:52 +00:00
multipath Yet another potential dereference of a dead provider. 2010-05-14 21:27:39 +00:00
nop
part Check that table is not NULL before access, it can be NULL 2010-08-03 09:10:48 +00:00
raid3 Move wakeup() out of mutex to reduce contention. 2010-01-05 10:52:21 +00:00
sched Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic. 2010-09-02 19:40:28 +00:00
shsec If provider is open for writing when we taste it, skip it for classes that 2009-10-09 09:42:22 +00:00
stripe Correct comment. 2010-02-18 22:28:12 +00:00
uzip Change the way in which zero stripesize is handled. Instead of reporting 2010-01-06 13:14:37 +00:00
vinum - Don't return EAGAIN from gv_unload(). It was used to work around the 2010-05-10 19:12:23 +00:00
virstor Prevent NULL deference by checking return value of 2010-02-02 22:25:22 +00:00
zero In g_zero_destroy_geom(), return 0 instead of EBUSY in the success case. 2010-05-10 19:08:53 +00:00
geom_aes.c
geom_bsd_enc.c
geom_bsd.c Trivial patch to show on which geom has the error been detected. 2008-12-01 15:02:00 +00:00
geom_ccd.c - Fix a potential NULL pointer reference. Note that this should not happen in 2008-11-25 20:28:33 +00:00
geom_ctl.c Add sbuf_new_auto as a shortcut for the very common case of creating a 2008-08-09 11:14:05 +00:00
geom_ctl.h
geom_dev.c fix a few cases where a string is passed via format argument instead of 2010-06-11 19:27:21 +00:00
geom_disk.c Export PCI IDs of ATA/SATA controllers through CAM and ata(4) layers to 2010-07-25 15:43:52 +00:00
geom_disk.h Export PCI IDs of ATA/SATA controllers through CAM and ata(4) layers to 2010-07-25 15:43:52 +00:00
geom_dump.c Escape characters unsafe for XML output in GEOM class, instance and 2010-03-20 16:16:13 +00:00
geom_event.c Try and narrow the gap in which you act on an event that has been canceled. 2010-06-08 22:40:02 +00:00
geom_fox.c
geom_int.h
geom_io.c Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic. 2010-09-02 19:40:28 +00:00
geom_kern.c Add sbuf_new_auto as a shortcut for the very common case of creating a 2008-08-09 11:14:05 +00:00
geom_mbr_enc.c
geom_mbr.c
geom_pc98_enc.c
geom_pc98.c
geom_redboot.c - Give geom_redboot taste of flash/spi. Now there is another provider 2010-02-03 01:12:19 +00:00
geom_slice.c Change the way in which zero stripesize is handled. Instead of reporting 2010-01-06 13:14:37 +00:00
geom_slice.h
geom_subr.c Fix deadlock between GEOM class unloading and withering. Withering can't 2010-05-05 18:53:24 +00:00
geom_sunlabel_enc.c
geom_sunlabel.c
geom_vfs.c g_vfs_open: allow only one mount per device vnode 2010-04-03 08:53:53 +00:00
geom_vfs.h Remove the struct thread unuseful argument from bufobj interface. 2008-10-10 21:23:50 +00:00
geom_vol_ffs.c
geom.h Fix deadlock between GEOM class unloading and withering. Withering can't 2010-05-05 18:53:24 +00:00
notes