aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/metaslab.c
diff options
context:
space:
mode:
authorGeorge Melikov <[email protected]>2017-02-02 00:14:02 +0300
committerBrian Behlendorf <[email protected]>2017-02-01 13:14:02 -0800
commit0f676dc228862ce0b4f9e27d06d394e9cbaa32e3 (patch)
treed922e67aa35cbdb12b57fc19324e3c8473c7e940 /module/zfs/metaslab.c
parent3b6425cb5bfd0fc2a14eee451ba36873318a96d9 (diff)
OpenZFS 7072 - zfs fails to expand if lun added when os is in shutdown state
Authored by: George Wilson <[email protected]> Reviewed by: Igor Kozhukhov <[email protected]> Reviewed by: Dan Kimmel <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Prakash Surya <[email protected]> Reviewed by: Alex Reece <[email protected]> Approved by: Dan McDonald <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7072 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/c39a2aa Closes #5694 Porting notes: - vdev.c: 'vdev_get_stats' changes are moved to 'vdev_get_stats_ex'. - vdev_disk.c: ignored, Linux specific code is different.
Diffstat (limited to 'module/zfs/metaslab.c')
-rw-r--r--module/zfs/metaslab.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c
index 3ada403a8..3fd7f9049 100644
--- a/module/zfs/metaslab.c
+++ b/module/zfs/metaslab.c
@@ -413,7 +413,13 @@ metaslab_class_expandable_space(metaslab_class_t *mc)
continue;
}
- space += tvd->vdev_max_asize - tvd->vdev_asize;
+ /*
+ * Calculate if we have enough space to add additional
+ * metaslabs. We report the expandable space in terms
+ * of the metaslab size since that's the unit of expansion.
+ */
+ space += P2ALIGN(tvd->vdev_max_asize - tvd->vdev_asize,
+ 1ULL << tvd->vdev_ms_shift);
}
spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG);
return (space);