Skip to content

Commit

Permalink
OpenZFS 9751 - Allocation throttling misplacing ditto blocks
Browse files Browse the repository at this point in the history
Relax allocation throttling for ditto blocks.  Due to random imbalances
in allocation it tends to push block copies to one vdev, that looks
slightly better at the moment.  Slightly less strict policy allows both
improve data security and surprisingly write performance, since we don't
need to touch extra metaslabs on each vdev to respect the min distance.

Sponsored by:	iXsystems, Inc.

Authored by: mav <mav@FreeBSD.org>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>

OpenZFS-issue: https://illumos.org/issues/9751
FreeBSD-commit: freebsd/freebsd-src@8253837ac3
Closes openzfs#7857
  • Loading branch information
amotin authored and behlendorf committed Sep 2, 2018
1 parent e38afd3 commit c197a77
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions module/zfs/metaslab.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ metaslab_group_fragmentation(metaslab_group_t *mg)
*/
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;
Expand Down Expand Up @@ -1033,6 +1033,13 @@ metaslab_group_allocatable(metaslab_group_t *mg, metaslab_group_t *rotor,
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 = refcount_count(&mg->mg_alloc_queue_depth[allocator]);

/*
Expand All @@ -1053,7 +1060,7 @@ metaslab_group_allocatable(metaslab_group_t *mg, metaslab_group_t *rotor,
*/
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 = refcount_count(
&mgp->mg_alloc_queue_depth[allocator]);

Expand Down Expand Up @@ -3379,7 +3386,7 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, uint64_t psize,
*/
if (allocatable && !GANG_ALLOCATION(flags) && !try_hard) {
allocatable = metaslab_group_allocatable(mg, rotor,
psize, allocator);
psize, allocator, d);
}

if (!allocatable) {
Expand Down

0 comments on commit c197a77

Please sign in to comment.