From owner-cvs-src-old@FreeBSD.ORG Thu Sep 2 19:40:54 2010 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C98C10656BC for ; Thu, 2 Sep 2010 19:40:54 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 36B6A8FC14 for ; Thu, 2 Sep 2010 19:40:54 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.4/8.14.4) with ESMTP id o82Jesj6030229 for ; Thu, 2 Sep 2010 19:40:54 GMT (envelope-from gibbs@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.4/8.14.4/Submit) id o82Jes1o030228 for cvs-src-old@freebsd.org; Thu, 2 Sep 2010 19:40:54 GMT (envelope-from gibbs@repoman.freebsd.org) Message-Id: <201009021940.o82Jes1o030228@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to gibbs@repoman.freebsd.org using -f From: "Justin T. Gibbs" Date: Thu, 2 Sep 2010 19:40:28 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/cam/ata ata_da.c src/sys/cam/scsi scsi_da.c src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs vdev_geom.c src/sys/geom geom_io.c src/sys/geom/sched subr_disk.c src/sys/kern subr_disk.c src/sys/sys bio.h X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 19:40:54 -0000 gibbs 2010-09-02 19:40:28 UTC FreeBSD src repository Modified files: sys/cam/ata ata_da.c sys/cam/scsi scsi_da.c sys/cddl/contrib/opensolaris/uts/common/fs/zfs vdev_geom.c sys/geom geom_io.c sys/geom/sched subr_disk.c sys/kern subr_disk.c sys/sys bio.h Log: SVN rev 212160 on 2010-09-02 19:40:28Z by gibbs 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 Revision Changes Path 1.20 +2 -1 src/sys/cam/ata/ata_da.c 1.252 +15 -6 src/sys/cam/scsi/scsi_da.c 1.24 +1 -0 src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c 1.86 +1 -0 src/sys/geom/geom_io.c 1.2 +27 -10 src/sys/geom/sched/subr_disk.c 1.93 +27 -10 src/sys/kern/subr_disk.c 1.150 +1 -0 src/sys/sys/bio.h