Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Aug 2018 15:00:41 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r337970 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201808171500.w7HF0fGG074133@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Aug 17 15:00:41 2018
New Revision: 337970
URL: https://svnweb.freebsd.org/changeset/base/337970

Log:
  9738 Fix third block copy allocations, broken at 9112.
  
  Use METASLAB_WEIGHT_CLAIM weight to allocate tertiary blocks.
  Previous use of METASLAB_WEIGHT_SECONDARY for that caused errors
  later on metaslab_activate_allocator() call, leading to massive
  load of unneeded metaslabs and write freezes.
  
  Reviewed by:	Paul Dagnelie <pcd@delphix.com>

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c	Fri Aug 17 15:00:10 2018	(r337969)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c	Fri Aug 17 15:00:41 2018	(r337970)
@@ -3081,7 +3081,6 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_
 	metaslab_t *msp = NULL;
 	uint64_t offset = -1ULL;
 	uint64_t activation_weight;
-	boolean_t tertiary = B_FALSE;
 
 	activation_weight = METASLAB_WEIGHT_PRIMARY;
 	for (int i = 0; i < d; i++) {
@@ -3090,7 +3089,7 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_
 			activation_weight = METASLAB_WEIGHT_SECONDARY;
 		} else if (activation_weight == METASLAB_WEIGHT_SECONDARY &&
 		    DVA_GET_VDEV(&dva[i]) == mg->mg_vd->vdev_id) {
-			tertiary = B_TRUE;
+			activation_weight = METASLAB_WEIGHT_CLAIM;
 			break;
 		}
 	}
@@ -3099,10 +3098,8 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_
 	 * If we don't have enough metaslabs active to fill the entire array, we
 	 * just use the 0th slot.
 	 */
-	if (mg->mg_ms_ready < mg->mg_allocators * 2) {
-		tertiary = B_FALSE;
+	if (mg->mg_ms_ready < mg->mg_allocators * 3)
 		allocator = 0;
-	}
 
 	ASSERT3U(mg->mg_vd->vdev_ms_count, >=, 2);
 
@@ -3128,7 +3125,7 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_
 			msp = mg->mg_primaries[allocator];
 			was_active = B_TRUE;
 		} else if (activation_weight == METASLAB_WEIGHT_SECONDARY &&
-		    mg->mg_secondaries[allocator] != NULL && !tertiary) {
+		    mg->mg_secondaries[allocator] != NULL) {
 			msp = mg->mg_secondaries[allocator];
 			was_active = B_TRUE;
 		} else {
@@ -3171,7 +3168,8 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_
 			continue;
 		}
 
-		if (msp->ms_weight & METASLAB_WEIGHT_CLAIM) {
+		if (msp->ms_weight & METASLAB_WEIGHT_CLAIM &&
+		    activation_weight != METASLAB_WEIGHT_CLAIM) {
 			metaslab_passivate(msp, msp->ms_weight &
 			    ~METASLAB_WEIGHT_CLAIM);
 			mutex_exit(&msp->ms_lock);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808171500.w7HF0fGG074133>