aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/metaslab.c
diff options
context:
space:
mode:
authorAlexander Motin <[email protected]>2023-07-28 16:30:33 -0400
committerGitHub <[email protected]>2023-07-28 13:30:33 -0700
commitb22bab2547b74b5df5e4698880e7d027b1d44509 (patch)
tree9074850fb8baebb959e7535f21d26c2d20c88ff9 /module/zfs/metaslab.c
parent5bdfff5cfc8baff48b3b59a577e7ef756a011024 (diff)
Remove fastwrite mechanism.
Fastwrite was introduced many years ago to improve ZIL writes spread between multiple top-level vdevs by tracking number of allocated but not written blocks and choosing vdev with smaller count. It suposed to reduce ZIL knowledge about allocation, but actually made ZIL to even more actively report allocation code about the allocations, complicating both ZIL and metaslabs code. On top of that, it seems ZIO_FLAG_FASTWRITE setting in dmu_sync() was lost many years ago, that was one of the declared benefits. Plus introduction of embedded log metaslab class solved another problem with allocation rotor accounting both normal and log allocations, since in most cases those are now in different metaslab classes. After all that, I'd prefer to simplify already too complicated ZIL, ZIO and metaslab code if the benefit of complexity is not obvious. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Wilson <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes #15107
Diffstat (limited to 'module/zfs/metaslab.c')
-rw-r--r--module/zfs/metaslab.c67
1 files changed, 2 insertions, 65 deletions
diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c
index 9991e1a22..8393e8dd9 100644
--- a/module/zfs/metaslab.c
+++ b/module/zfs/metaslab.c
@@ -5101,7 +5101,7 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, uint64_t psize,
zio_alloc_list_t *zal, int allocator)
{
metaslab_class_allocator_t *mca = &mc->mc_allocator[allocator];
- metaslab_group_t *mg, *fast_mg, *rotor;
+ metaslab_group_t *mg, *rotor;
vdev_t *vd;
boolean_t try_hard = B_FALSE;
@@ -5164,15 +5164,6 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, uint64_t psize,
} else if (d != 0) {
vd = vdev_lookup_top(spa, DVA_GET_VDEV(&dva[d - 1]));
mg = vd->vdev_mg->mg_next;
- } else if (flags & METASLAB_FASTWRITE) {
- mg = fast_mg = mca->mca_rotor;
-
- do {
- if (fast_mg->mg_vd->vdev_pending_fastwrite <
- mg->mg_vd->vdev_pending_fastwrite)
- mg = fast_mg;
- } while ((fast_mg = fast_mg->mg_next) != mca->mca_rotor);
-
} else {
ASSERT(mca->mca_rotor != NULL);
mg = mca->mca_rotor;
@@ -5297,7 +5288,7 @@ top:
mg->mg_bias = 0;
}
- if ((flags & METASLAB_FASTWRITE) ||
+ if ((flags & METASLAB_ZIL) ||
atomic_add_64_nv(&mca->mca_aliquot, asize) >=
mg->mg_aliquot + mg->mg_bias) {
mca->mca_rotor = mg->mg_next;
@@ -5310,11 +5301,6 @@ top:
((flags & METASLAB_GANG_HEADER) ? 1 : 0));
DVA_SET_ASIZE(&dva[d], asize);
- if (flags & METASLAB_FASTWRITE) {
- atomic_add_64(&vd->vdev_pending_fastwrite,
- psize);
- }
-
return (0);
}
next:
@@ -5950,55 +5936,6 @@ metaslab_claim(spa_t *spa, const blkptr_t *bp, uint64_t txg)
return (error);
}
-void
-metaslab_fastwrite_mark(spa_t *spa, const blkptr_t *bp)
-{
- const dva_t *dva = bp->blk_dva;
- int ndvas = BP_GET_NDVAS(bp);
- uint64_t psize = BP_GET_PSIZE(bp);
- int d;
- vdev_t *vd;
-
- ASSERT(!BP_IS_HOLE(bp));
- ASSERT(!BP_IS_EMBEDDED(bp));
- ASSERT(psize > 0);
-
- spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
-
- for (d = 0; d < ndvas; d++) {
- if ((vd = vdev_lookup_top(spa, DVA_GET_VDEV(&dva[d]))) == NULL)
- continue;
- atomic_add_64(&vd->vdev_pending_fastwrite, psize);
- }
-
- spa_config_exit(spa, SCL_VDEV, FTAG);
-}
-
-void
-metaslab_fastwrite_unmark(spa_t *spa, const blkptr_t *bp)
-{
- const dva_t *dva = bp->blk_dva;
- int ndvas = BP_GET_NDVAS(bp);
- uint64_t psize = BP_GET_PSIZE(bp);
- int d;
- vdev_t *vd;
-
- ASSERT(!BP_IS_HOLE(bp));
- ASSERT(!BP_IS_EMBEDDED(bp));
- ASSERT(psize > 0);
-
- spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
-
- for (d = 0; d < ndvas; d++) {
- if ((vd = vdev_lookup_top(spa, DVA_GET_VDEV(&dva[d]))) == NULL)
- continue;
- ASSERT3U(vd->vdev_pending_fastwrite, >=, psize);
- atomic_sub_64(&vd->vdev_pending_fastwrite, psize);
- }
-
- spa_config_exit(spa, SCL_VDEV, FTAG);
-}
-
static void
metaslab_check_free_impl_cb(uint64_t inner, vdev_t *vd, uint64_t offset,
uint64_t size, void *arg)