usr/src/uts/common/fs/zfs/zvol.c
changeset 12294 2a74b443e6b1
parent 12285 d736d62dcca2
child 12296 7cf402a7f374
--- a/usr/src/uts/common/fs/zfs/zvol.c	Mon May 03 04:17:29 2010 -0700
+++ b/usr/src/uts/common/fs/zfs/zvol.c	Mon May 03 09:07:08 2010 -0600
@@ -22,6 +22,8 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
+/* Portions Copyright 2010 Robert Milkowski */
+
 /*
  * ZFS volume emulation driver.
  *
@@ -525,7 +527,10 @@
 	ASSERT(error == 0);
 	zv->zv_volblocksize = doi.doi_data_block_size;
 
-	zil_replay(os, zv, zvol_replay_vector);
+	if (zil_replay_disable)
+		zil_destroy(dmu_objset_zil(os), B_FALSE);
+	else
+		zil_replay(os, zv, zvol_replay_vector);
 	dmu_objset_disown(os, zvol_tag);
 	zv->zv_objset = NULL;
 
@@ -988,9 +993,6 @@
 	boolean_t slogging;
 	ssize_t immediate_write_sz;
 
-	if (zil_disable)
-		return;
-
 	if (zil_replaying(zilog, tx))
 		return;
 
@@ -1182,8 +1184,10 @@
 	}
 
 	is_dump = zv->zv_flags & ZVOL_DUMPIFIED;
-	sync = !(bp->b_flags & B_ASYNC) && !doread && !is_dump &&
-	    !(zv->zv_flags & ZVOL_WCE) && !zil_disable;
+	sync = ((!(bp->b_flags & B_ASYNC) &&
+	    !(zv->zv_flags & ZVOL_WCE)) ||
+	    (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS)) &&
+	    !doread && !is_dump;
 
 	/*
 	 * There must be no buffer changes when doing a dmu_sync() because
@@ -1363,7 +1367,8 @@
 		return (error);
 	}
 
-	sync = !(zv->zv_flags & ZVOL_WCE) && !zil_disable;
+	sync = !(zv->zv_flags & ZVOL_WCE) ||
+	    (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS);
 
 	rl = zfs_range_lock(&zv->zv_znode, uio->uio_loffset, uio->uio_resid,
 	    RL_WRITER);