svn commit: r247342 - head/usr.sbin/bhyve

Neel Natu neel at FreeBSD.org
Tue Feb 26 20:02:17 UTC 2013


Author: neel
Date: Tue Feb 26 20:02:17 2013
New Revision: 247342
URL: http://svnweb.freebsd.org/changeset/base/247342

Log:
  Ignore the BARRIER flag in the virtio block header.
  
  This capability is not advertised by the host so ignore it even if the guest
  insists on setting the flag.
  
  Reviewed by:	grehan
  Obtained from:	NetApp

Modified:
  head/usr.sbin/bhyve/pci_virtio_block.c

Modified: head/usr.sbin/bhyve/pci_virtio_block.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_block.c	Tue Feb 26 20:01:05 2013	(r247341)
+++ head/usr.sbin/bhyve/pci_virtio_block.c	Tue Feb 26 20:02:17 2013	(r247342)
@@ -110,8 +110,9 @@ CTASSERT(sizeof(struct vtblk_config) == 
  * Fixed-size block header
  */
 struct virtio_blk_hdr {
-#define VBH_OP_READ	0
-#define VBH_OP_WRITE	1
+#define	VBH_OP_READ		0
+#define	VBH_OP_WRITE		1
+#define	VBH_FLAG_BARRIER	0x80000000	/* OR'ed into vbh_type */
 	uint32_t       	vbh_type;
 	uint32_t	vbh_ioprio;
 	uint64_t	vbh_sector;
@@ -198,7 +199,7 @@ pci_vtblk_proc(struct pci_vtblk_softc *s
 	int iolen;
 	int nsegs;
 	int uidx, aidx, didx;
-	int writeop;
+	int writeop, type;
 	off_t offset;
 
 	uidx = *hq->hq_used_idx;
@@ -232,7 +233,13 @@ pci_vtblk_proc(struct pci_vtblk_softc *s
 	assert(vid[0].vd_flags & VRING_DESC_F_NEXT);
 	assert((vid[0].vd_flags & VRING_DESC_F_WRITE) == 0);
 
-	writeop = (vbh->vbh_type == VBH_OP_WRITE);
+	/*
+	 * XXX
+	 * The guest should not be setting the BARRIER flag because
+	 * we don't advertise the capability.
+	 */
+	type = vbh->vbh_type & ~VBH_FLAG_BARRIER;
+	writeop = (type == VBH_OP_WRITE);
 
 	offset = vbh->vbh_sector * DEV_BSIZE;
 


More information about the svn-src-head mailing list