changeset 21397:cc6857011980

9751 Allocation throttling misplacing ditto blocks Portions contributed by: Kody Kantor <kody.kantor@joyent.com> Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed by: Matt Ahrens <matt@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Approved by: Gordon Ross <gwr@nexenta.com>
author Alexander Motin <mav@FreeBSD.org>
date Mon, 22 Apr 2019 19:09:42 +0000
parents a1dd191628fc
children 6b5d876262d2
files usr/src/uts/common/fs/zfs/metaslab.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/metaslab.c	Tue Oct 17 10:04:43 2017 -0400
+++ b/usr/src/uts/common/fs/zfs/metaslab.c	Mon Apr 22 19:09:42 2019 +0000
@@ -1012,7 +1012,7 @@
  */
 static boolean_t
 metaslab_group_allocatable(metaslab_group_t *mg, metaslab_group_t *rotor,
-    uint64_t psize, int allocator)
+    uint64_t psize, int allocator, int d)
 {
 	spa_t *spa = mg->mg_vd->vdev_spa;
 	metaslab_class_t *mc = mg->mg_class;
@@ -1056,6 +1056,13 @@
 		if (mg->mg_no_free_space)
 			return (B_FALSE);
 
+		/*
+		 * Relax allocation throttling for ditto blocks.  Due to
+		 * random imbalances in allocation it tends to push copies
+		 * to one vdev, that looks a bit better at the moment.
+		 */
+		qmax = qmax * (4 + d) / 4;
+
 		qdepth = zfs_refcount_count(
 		    &mg->mg_alloc_queue_depth[allocator]);
 
@@ -1077,7 +1084,7 @@
 		 */
 		for (mgp = mg->mg_next; mgp != rotor; mgp = mgp->mg_next) {
 			qmax = mgp->mg_cur_max_alloc_queue_depth[allocator];
-
+			qmax = qmax * (4 + d) / 4;
 			qdepth = zfs_refcount_count(
 			    &mgp->mg_alloc_queue_depth[allocator]);
 
@@ -3710,7 +3717,7 @@
 		 */
 		if (allocatable && !GANG_ALLOCATION(flags) && !try_hard) {
 			allocatable = metaslab_group_allocatable(mg, rotor,
-			    psize, allocator);
+			    psize, allocator, d);
 		}
 
 		if (!allocatable) {