usr/src/uts/common/fs/zfs/zio.c
changeset 13572 85c66b89d5f2
parent 13414 b42c1f0432b6
child 13700 2889e2596bd6
--- a/usr/src/uts/common/fs/zfs/zio.c	Mon Jan 23 18:43:32 2012 -0800
+++ b/usr/src/uts/common/fs/zfs/zio.c	Mon Jan 23 18:47:28 2012 -0800
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
  */
 
@@ -2219,13 +2219,22 @@
 
 	ASSERT(txg > spa_syncing_txg(spa));
 
-	if (use_slog)
+	/*
+	 * ZIL blocks are always contiguous (i.e. not gang blocks) so we
+	 * set the METASLAB_GANG_AVOID flag so that they don't "fast gang"
+	 * when allocating them.
+	 */
+	if (use_slog) {
 		error = metaslab_alloc(spa, spa_log_class(spa), size,
-		    new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID);
-
-	if (error)
+		    new_bp, 1, txg, old_bp,
+		    METASLAB_HINTBP_AVOID | METASLAB_GANG_AVOID);
+	}
+
+	if (error) {
 		error = metaslab_alloc(spa, spa_normal_class(spa), size,
-		    new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID);
+		    new_bp, 1, txg, old_bp,
+		    METASLAB_HINTBP_AVOID | METASLAB_GANG_AVOID);
+	}
 
 	if (error == 0) {
 		BP_SET_LSIZE(new_bp, size);