summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2015-07-28 10:22:56 -0400
committerBrian Behlendorf <[email protected]>2016-01-15 15:38:35 -0800
commitb10695c8f1ce317cd24d99af7998741a35a5ce48 (patch)
treee75355476113384705fbcfb7e121ad667d851228
parentc96c36fa22ab97f6b3025b356bfca8d9e030d002 (diff)
Remove fastwrite mutex
The fast write mutex is intended to protect accounting, but it is redundant because all accounting is performed through atomic operations. It also serializes all metaslab IO behind a mutex, which introduces a theoretical scaling regression that the Illumos developers did not like when we showed this to them. Removing it makes the selection of the metaslab_group lock free as it is on Illumos. The selection is not quite the same without the lock because the loop races with IO completions, but any imbalances caused by this are likely to be corrected by subsequent metaslab group selections. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3643
-rw-r--r--include/sys/metaslab_impl.h1
-rw-r--r--module/zfs/metaslab.c9
2 files changed, 0 insertions, 10 deletions
diff --git a/include/sys/metaslab_impl.h b/include/sys/metaslab_impl.h
index 88bda071f..27a53b515 100644
--- a/include/sys/metaslab_impl.h
+++ b/include/sys/metaslab_impl.h
@@ -69,7 +69,6 @@ struct metaslab_class {
uint64_t mc_space; /* total space (alloc + free) */
uint64_t mc_dspace; /* total deflated space */
uint64_t mc_histogram[RANGE_TREE_HISTOGRAM_SIZE];
- kmutex_t mc_fastwrite_lock;
};
/*
diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c
index 8946f39ad..19323cdb8 100644
--- a/module/zfs/metaslab.c
+++ b/module/zfs/metaslab.c
@@ -198,7 +198,6 @@ metaslab_class_create(spa_t *spa, metaslab_ops_t *ops)
mc->mc_spa = spa;
mc->mc_rotor = NULL;
mc->mc_ops = ops;
- mutex_init(&mc->mc_fastwrite_lock, NULL, MUTEX_DEFAULT, NULL);
return (mc);
}
@@ -212,7 +211,6 @@ metaslab_class_destroy(metaslab_class_t *mc)
ASSERT(mc->mc_space == 0);
ASSERT(mc->mc_dspace == 0);
- mutex_destroy(&mc->mc_fastwrite_lock);
kmem_free(mc, sizeof (metaslab_class_t));
}
@@ -2214,9 +2212,6 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, uint64_t psize,
if (psize >= metaslab_gang_bang && (ddi_get_lbolt() & 3) == 0)
return (SET_ERROR(ENOSPC));
- if (flags & METASLAB_FASTWRITE)
- mutex_enter(&mc->mc_fastwrite_lock);
-
/*
* Start at the rotor and loop through all mgs until we find something.
* Note that there's no locking on mc_rotor or mc_aliquot because
@@ -2401,7 +2396,6 @@ top:
if (flags & METASLAB_FASTWRITE) {
atomic_add_64(&vd->vdev_pending_fastwrite,
psize);
- mutex_exit(&mc->mc_fastwrite_lock);
}
return (0);
@@ -2425,9 +2419,6 @@ next:
bzero(&dva[d], sizeof (dva_t));
- if (flags & METASLAB_FASTWRITE)
- mutex_exit(&mc->mc_fastwrite_lock);
-
return (SET_ERROR(ENOSPC));
}