summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2014-10-07 17:08:53 +0000
committerneel <neel@FreeBSD.org>2014-10-07 17:08:53 +0000
commit8cd4bd98b6e566b3556a8bed73458e7b32cbbe77 (patch)
treea2717bcf9b1d85c4f2c3a368ababf6e52f4ee6e4 /usr.sbin
parente2d6ebec55f41f7360a1479231b139957f19dc26 (diff)
downloadFreeBSD-src-8cd4bd98b6e566b3556a8bed73458e7b32cbbe77.zip
FreeBSD-src-8cd4bd98b6e566b3556a8bed73458e7b32cbbe77.tar.gz
Implement the FLUSH operation in the virtio-block emulation.
This gets rid of the following error message during FreeBSD guest bootup: "vtbd0: hard error cmd=flush fsbn 0" Reported by: rodrigc Reviewed by: grehan
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bhyve/pci_virtio_block.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c
index 394b116..c66ad68 100644
--- a/usr.sbin/bhyve/pci_virtio_block.c
+++ b/usr.sbin/bhyve/pci_virtio_block.c
@@ -94,6 +94,8 @@ struct vtblk_config {
struct virtio_blk_hdr {
#define VBH_OP_READ 0
#define VBH_OP_WRITE 1
+#define VBH_OP_FLUSH 4
+#define VBH_OP_FLUSH_OUT 5
#define VBH_OP_IDENT 8
#define VBH_FLAG_BARRIER 0x80000000 /* OR'ed into vbh_type */
uint32_t vbh_type;
@@ -217,6 +219,10 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq)
MIN(iov[1].iov_len, sizeof(sc->vbsc_ident)));
err = 0;
break;
+ case VBH_OP_FLUSH:
+ case VBH_OP_FLUSH_OUT:
+ err = fsync(sc->vbsc_fd);
+ break;
default:
err = -ENOSYS;
break;
OpenPOWER on IntegriCloud