Skip to content

Commit

Permalink
7446 zpool create should support efi system partition
Browse files Browse the repository at this point in the history
illumos/illumos-gate@7855d95
illumos/illumos-gate@7855d95

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 <[email protected]>
Reviewed by: Yuri Pankov <[email protected]>
Approved by: Dan McDonald <[email protected]>
Author: Toomas Soome <[email protected]>


git-svn-id: https://svn.freebsd.org/base/vendor-sys/illumos/dist@318941 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
  • Loading branch information
avg committed May 26, 2017
1 parent d215bce commit 5d9dbca
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions common/zfs/zpool_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ zpool_prop_init(void)
PROP_READONLY, ZFS_TYPE_POOL, "<1.00x or higher if deduped>",
"DEDUP");

/* system partition size */
zprop_register_number(ZPOOL_PROP_BOOTSIZE, "bootsize", 0, PROP_ONETIME,
ZFS_TYPE_POOL, "<size>", "BOOTSIZE");

/* default number properties */
zprop_register_number(ZPOOL_PROP_VERSION, "version", SPA_VERSION,
PROP_DEFAULT, ZFS_TYPE_POOL, "<version>", "VERSION");
Expand Down
9 changes: 7 additions & 2 deletions uts/common/fs/zfs/metaslab.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,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;

Expand All @@ -406,9 +407,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);
Expand Down
1 change: 1 addition & 0 deletions uts/common/fs/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -2738,6 +2738,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation);
spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode);
spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand);
spa_prop_find(spa, ZPOOL_PROP_BOOTSIZE, &spa->spa_bootsize);
spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO,
&spa->spa_dedup_ditto);

Expand Down
1 change: 1 addition & 0 deletions uts/common/fs/zfs/sys/spa_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ struct spa {
int spa_mode; /* FREAD | FWRITE */
spa_log_state_t spa_log_state; /* log state */
uint64_t spa_autoexpand; /* lun expansion on/off */
uint64_t spa_bootsize; /* efi system partition size */
ddt_t *spa_ddt[ZIO_CHECKSUM_FUNCTIONS]; /* in-core DDTs */
uint64_t spa_ddt_stat_object; /* DDT statistics */
uint64_t spa_dedup_ditto; /* dedup ditto threshold */
Expand Down
4 changes: 2 additions & 2 deletions uts/common/fs/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2765,8 +2765,8 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *vs)
* since that determines how much space the pool can expand.
*/
if (vd->vdev_aux == NULL && tvd != NULL) {
vs->vs_esize = P2ALIGN(vd->vdev_max_asize - vd->vdev_asize,
1ULL << tvd->vdev_ms_shift);
vs->vs_esize = P2ALIGN(vd->vdev_max_asize - vd->vdev_asize -
spa->spa_bootsize, 1ULL << tvd->vdev_ms_shift);
}
if (vd->vdev_aux == NULL && vd == vd->vdev_top && !vd->vdev_ishole) {
vs->vs_fragmentation = vd->vdev_mg->mg_fragmentation;
Expand Down
1 change: 1 addition & 0 deletions uts/common/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ typedef enum {
ZPOOL_PROP_FRAGMENTATION,
ZPOOL_PROP_LEAKED,
ZPOOL_PROP_MAXBLOCKSIZE,
ZPOOL_PROP_BOOTSIZE,
ZPOOL_NUM_PROPS
} zpool_prop_t;

Expand Down

0 comments on commit 5d9dbca

Please sign in to comment.