diff options
author | mav <mav@FreeBSD.org> | 2016-10-14 07:16:51 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2016-10-14 07:16:51 +0000 |
commit | 5e3d137885ee87b32c2bd81eb1610383a1893fc6 (patch) | |
tree | 7f84f5bc38d3e7345c8907d771c75e81021582bc /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c | |
parent | 7b486c4fa95c260ad563ac3ea2bf866095c0465e (diff) | |
download | FreeBSD-src-5e3d137885ee87b32c2bd81eb1610383a1893fc6.zip FreeBSD-src-5e3d137885ee87b32c2bd81eb1610383a1893fc6.tar.gz |
MFC r305324: MFV r303077:
7072 zfs fails to expand if lun added when os is in shutdown state
illumos/illumos-gate@c39a2aae1e2c439d156021edfc20910dad7f9891
https://github.com/illumos/illumos-gate/commit/c39a2aae1e2c439d156021edfc20910da
d7f9891
https://www.illumos.org/issues/7072
upstream:
38733 zfs fails to expand if lun added when os is in shutdown state
DLPX-36910 spares and caches should not display expandable space
DLPX-39262 vdev_disk_open spam zfs_dbgmsg buffer
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: George Wilson <george.wilson@delphix.com>
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c index 0e75746..a279aa8 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c @@ -489,7 +489,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); |