Illumos #1909: disk sync write perf regression when slog is used post oi_148
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 19 Apr 2012 22:55:28 +0000 (15:55 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 19 Apr 2012 23:26:29 +0000 (16:26 -0700)
Reviewed by: Matt Ahrens <matt@delphix.com>
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Richard Elling <richard.elling@richardelling.com>
Reviewed by: Steve Gonczi <gonczi@comcast.net>
Reviewed by: Garrett D'Amore <garrett.damore@gmail.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: Eric Schrock <eric.schrock@delphix.com>

Refererces to Illumos issue:
  https://www.illumos.org/issues/1909

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #680

module/zfs/metaslab.c
module/zfs/zio.c

index b089f1e..c33c5e8 100644 (file)
@@ -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.
  */
 
 #include <sys/zfs_context.h>
@@ -38,7 +38,7 @@
  * avoid having to load lots of space_maps in a given txg. There are,
  * however, some cases where we want to avoid "fast" ganging and instead
  * we want to do an exhaustive search of all metaslabs on this device.
- * Currently we don't allow any gang or dump device related allocations
+ * Currently we don't allow any gang, zil, or dump device related allocations
  * to "fast" gang.
  */
 #define        CAN_FASTGANG(flags) \
index 149088d..206ed9a 100644 (file)
@@ -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.
  */
 
@@ -2317,13 +2317,22 @@ zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp,
 
        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);
+                   new_bp, 1, txg, old_bp,
+                   METASLAB_HINTBP_AVOID | METASLAB_GANG_AVOID);
+       }
 
-       if (error)
+       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);