Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
Show First 20 Lines • Show All 796 Lines • ▼ Show 20 Lines | if (reason != VDEV_LABEL_REMOVE && reason != VDEV_LABEL_SPARE && | ||||
* already labeled appropriately and we can just return. | * already labeled appropriately and we can just return. | ||||
*/ | */ | ||||
if (reason == VDEV_LABEL_L2CACHE) | if (reason == VDEV_LABEL_L2CACHE) | ||||
return (0); | return (0); | ||||
ASSERT(reason == VDEV_LABEL_REPLACE); | ASSERT(reason == VDEV_LABEL_REPLACE); | ||||
} | } | ||||
/* | /* | ||||
* TRIM the whole thing so that we start with a clean slate. | * TRIM the whole thing, excluding the blank space and boot header | ||||
* as specified by ZFS On-Disk Specification (section 1.3), so that | |||||
* we start with a clean slate. | |||||
* It's just an optimization, so we don't care if it fails. | * It's just an optimization, so we don't care if it fails. | ||||
* Don't TRIM if removing so that we don't interfere with zpool | * Don't TRIM if removing so that we don't interfere with zpool | ||||
* disaster recovery. | * disaster recovery. | ||||
*/ | */ | ||||
if (zfs_trim_enabled && vdev_trim_on_init && !vd->vdev_notrim && | if (zfs_trim_enabled && vdev_trim_on_init && !vd->vdev_notrim && | ||||
(reason == VDEV_LABEL_CREATE || reason == VDEV_LABEL_SPARE || | (reason == VDEV_LABEL_CREATE || reason == VDEV_LABEL_SPARE || | ||||
reason == VDEV_LABEL_L2CACHE)) | reason == VDEV_LABEL_L2CACHE)) | ||||
zio_wait(zio_trim(NULL, spa, vd, 0, vd->vdev_psize)); | zio_wait(zio_trim(NULL, spa, vd, VDEV_SKIP_SIZE, | ||||
vd->vdev_psize - VDEV_SKIP_SIZE)); | |||||
imp: I'd have expected the size to be trimmed as well... or is this a start block to end block API | |||||
Done Inline ActionsNo, it's start plus size. avg: No, it's start plus size.
Good catch. | |||||
/* | /* | ||||
* Initialize its label. | * Initialize its label. | ||||
*/ | */ | ||||
vp_abd = abd_alloc_linear(sizeof (vdev_phys_t), B_TRUE); | vp_abd = abd_alloc_linear(sizeof (vdev_phys_t), B_TRUE); | ||||
abd_zero(vp_abd, sizeof (vdev_phys_t)); | abd_zero(vp_abd, sizeof (vdev_phys_t)); | ||||
vp = abd_to_buf(vp_abd); | vp = abd_to_buf(vp_abd); | ||||
▲ Show 20 Lines • Show All 625 Lines • Show Last 20 Lines |
I'd have expected the size to be trimmed as well... or is this a start block to end block API