diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index b2e7dc4a5b4d..3f46bd0513c9 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -6035,6 +6035,7 @@ print_one_column(zpool_prop_t prop, uint64_t value, const char *str, size_t width = zprop_width(prop, &fixed, ZFS_TYPE_POOL); switch (prop) { + case ZPOOL_PROP_SIZE: case ZPOOL_PROP_EXPANDSZ: case ZPOOL_PROP_CHECKPOINT: case ZPOOL_PROP_DEDUPRATIO: @@ -6130,8 +6131,12 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv, * 'toplevel' boolean value is passed to the print_one_column() * to indicate that the value is valid. */ - print_one_column(ZPOOL_PROP_SIZE, vs->vs_space, NULL, scripted, - toplevel, format); + if (vs->vs_pspace) + print_one_column(ZPOOL_PROP_SIZE, vs->vs_pspace, NULL, + scripted, B_TRUE, format); + else + print_one_column(ZPOOL_PROP_SIZE, vs->vs_space, NULL, + scripted, toplevel, format); print_one_column(ZPOOL_PROP_ALLOCATED, vs->vs_alloc, NULL, scripted, toplevel, format); print_one_column(ZPOOL_PROP_FREE, vs->vs_space - vs->vs_alloc, diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index 5bbac576df02..c8e199fc679c 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -1102,6 +1102,7 @@ typedef struct vdev_stat { uint64_t vs_configured_ashift; /* TLV vdev_ashift */ uint64_t vs_logical_ashift; /* vdev_logical_ashift */ uint64_t vs_physical_ashift; /* vdev_physical_ashift */ + uint64_t vs_pspace; /* physical capacity */ } vdev_stat_t; /* BEGIN CSTYLED */ diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index 636bb5005a1e..ccc35adc9f4b 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -4406,6 +4406,7 @@ vdev_get_stats_ex(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx) vs->vs_rsize = vdev_get_min_asize(vd); if (vd->vdev_ops->vdev_op_leaf) { + vs->vs_pspace = vd->vdev_psize; vs->vs_rsize += VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; /* diff --git a/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh b/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh index 59f64081a977..a18e634cefa7 100755 --- a/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh +++ b/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh @@ -48,14 +48,18 @@ log_must zpool checkpoint $NESTEDPOOL log_must truncate -s $EXPSZ $FILEDISK1 log_must zpool online -e $NESTEDPOOL $FILEDISK1 NEWSZ=$(zpool list -v | grep "$FILEDISK1" | awk '{print $2}') +DEXPSZ=$(zpool list -v | grep "$FILEDISK1" | awk '{print $6}') nested_change_state_after_checkpoint log_mustnot [ "$INITSZ" = "$NEWSZ" ] +log_must [ "$DEXPSZ" = "-" ] log_must zpool export $NESTEDPOOL log_must zpool import -d $FILEDISKDIR --rewind-to-checkpoint $NESTEDPOOL nested_verify_pre_checkpoint_state FINSZ=$(zpool list -v | grep "$FILEDISK1" | awk '{print $2}') -log_must [ "$INITSZ" = "$FINSZ" ] +DEXPSZ=$(zpool list -v | grep "$FILEDISK1" | awk '{print $6}') +log_must [ "$EXPSZ" = "$FINSZ" ] +log_must [ "$DEXPSZ" != "-" ] log_pass "LUN expansion rewinded correctly."