Skip to content

Commit

Permalink
Illumos 5161 - add tunable for number of metaslabs per vdev
Browse files Browse the repository at this point in the history
5161 add tunable for number of metaslabs per vdev
Reviewed by: Alex Reece <alex.reece@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Saso Kiselkov <skiselkov.ml@gmail.com>
Reviewed by: Richard Elling <richard.elling@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

References:
  https://www.illumos.org/issues/5161
  illumos/illumos-gate@bf3e216

Ported by: Turbo Fredriksson <turbo@bayour.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2698
  • Loading branch information
ahrens authored and behlendorf committed Sep 23, 2014
1 parent ebcf493 commit b8bcca1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
11 changes: 11 additions & 0 deletions man/man5/zfs-module-parameters.5
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ Enable use of the fragmentation metric in computing metaslab weights.
Use \fB1\fR for yes (default) and \fB0\fR for no.
.RE

.sp
.ne 2
.na
\fBmetaslabs_per_vdev\fR (int)
.ad
.RS 12n
When a vdev is added, it will be divided into approximately (but no more than) this number of metaslabs.
.sp
Default value: \fB200\fR.
.RE

.sp
.ne 2
.na
Expand Down
15 changes: 13 additions & 2 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
#include <sys/dsl_scan.h>
#include <sys/zvol.h>

/*
* When a vdev is added, it will be divided into approximately (but no
* more than) this number of metaslabs.
*/
int metaslabs_per_vdev = 200;

/*
* Virtual device management.
*/
Expand Down Expand Up @@ -1582,9 +1588,9 @@ void
vdev_metaslab_set_size(vdev_t *vd)
{
/*
* Aim for roughly 200 metaslabs per vdev.
* Aim for roughly metaslabs_per_vdev (default 200) metaslabs per vdev.
*/
vd->vdev_ms_shift = highbit64(vd->vdev_asize / 200);
vd->vdev_ms_shift = highbit64(vd->vdev_asize / metaslabs_per_vdev);
vd->vdev_ms_shift = MAX(vd->vdev_ms_shift, SPA_MAXBLOCKSHIFT);
}

Expand Down Expand Up @@ -3387,4 +3393,9 @@ EXPORT_SYMBOL(vdev_degrade);
EXPORT_SYMBOL(vdev_online);
EXPORT_SYMBOL(vdev_offline);
EXPORT_SYMBOL(vdev_clear);

module_param(metaslabs_per_vdev, int, 0644);
MODULE_PARM_DESC(metaslabs_per_vdev,
"Divide added vdev into approximately (but no more than) this number "
"of metaslabs");
#endif

0 comments on commit b8bcca1

Please sign in to comment.