aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2018-02-21 00:18:57 +0000
committerAlexander Motin <mav@FreeBSD.org>2018-02-21 00:18:57 +0000
commite5a4a83784d26b3804df1c9519078e64776bf10b (patch)
treeba06d0fb4b60e26c2b5cc942efdfe2c91db7e262 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
parente73c944fc079f7f08a32270eb83854e3270b05e4 (diff)
parent9df2d6f729b7642daf9a1d5d3d610959ba894c3d (diff)
downloadsrc-e5a4a83784d26b3804df1c9519078e64776bf10b.tar.gz
src-e5a4a83784d26b3804df1c9519078e64776bf10b.zip
MFV r318941: 7446 zpool create should support efi system partition
illumos/illumos-gate@7855d95b30fd903e3918bad5a29b777e765db821 https://github.com/illumos/illumos-gate/commit/7855d95b30fd903e3918bad5a29b777e765db821 https://www.illumos.org/issues/7446 Since we support whole-disk configuration for boot pool, we also will need whole disk support with UEFI boot and for this, zpool create should create efi- system partition. I have borrowed the idea from oracle solaris, and introducing zpool create - B switch to provide an way to specify that boot partition should be created. However, there is still an question, how big should the system partition be. For time being, I have set default size 256MB (thats minimum size for FAT32 with 4k blocks). To support custom size, the set on creation "bootsize" property is created and so the custom size can be set as: zpool create B - o bootsize=34MB rpool c0t0d0 After pool is created, the "bootsize" property is read only. When -B switch is not used, the bootsize defaults to 0 and is shown in zpool get output with value ''. Older zfs/zpool implementations are ignoring this property. https://www.illumos.org/rb/r/219/ Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Reviewed by: Yuri Pankov <yuri.pankov@gmail.com> Approved by: Dan McDonald <danmcd@kebe.com> Author: Toomas Soome <tsoome@me.com> This commit makes no sense for FreeBSD, that is why I blocked the option, but it should be good to stay closer to upstream.
Notes
Notes: svn path=/head/; revision=329681
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.c9
1 files changed, 7 insertions, 2 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 6159b259247b..c10ca655072c 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
@@ -481,6 +481,7 @@ metaslab_class_expandable_space(metaslab_class_t *mc)
spa_config_enter(mc->mc_spa, SCL_VDEV, FTAG, RW_READER);
for (int c = 0; c < rvd->vdev_children; c++) {
+ uint64_t tspace;
vdev_t *tvd = rvd->vdev_child[c];
metaslab_group_t *mg = tvd->vdev_mg;
@@ -493,9 +494,13 @@ metaslab_class_expandable_space(metaslab_class_t *mc)
* 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.
+ * Adjust by efi system partition size.
*/
- space += P2ALIGN(tvd->vdev_max_asize - tvd->vdev_asize,
- 1ULL << tvd->vdev_ms_shift);
+ tspace = tvd->vdev_max_asize - tvd->vdev_asize;
+ if (tspace > mc->mc_spa->spa_bootsize) {
+ tspace -= mc->mc_spa->spa_bootsize;
+ }
+ space += P2ALIGN(tspace, 1ULL << tvd->vdev_ms_shift);
}
spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG);
return (space);