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 865 Lines • ▼ Show 20 Lines | retry: | ||||
if (error == 0 && !vd->vdev_isl2cache && | if (error == 0 && !vd->vdev_isl2cache && | ||||
(reason == VDEV_LABEL_L2CACHE || | (reason == VDEV_LABEL_L2CACHE || | ||||
spa_l2cache_exists(vd->vdev_guid, NULL))) | spa_l2cache_exists(vd->vdev_guid, NULL))) | ||||
spa_l2cache_add(vd); | spa_l2cache_add(vd); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | |||||
vdev_label_write_pad2(vdev_t *vd, const char *buf, size_t size) | |||||
{ | |||||
spa_t *spa = vd->vdev_spa; | |||||
zio_t *zio; | |||||
char *pad2; | |||||
int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL; | |||||
int error; | |||||
if (size > VDEV_PAD_SIZE) | |||||
return (EINVAL); | |||||
if (!vd->vdev_ops->vdev_op_leaf) | |||||
return (ENODEV); | |||||
if (vdev_is_dead(vd)) | |||||
return (ENXIO); | |||||
ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL); | |||||
pad2 = zio_buf_alloc(VDEV_PAD_SIZE); | |||||
bzero(pad2, VDEV_PAD_SIZE); | |||||
memcpy(pad2, buf, size); | |||||
retry: | |||||
zio = zio_root(spa, NULL, NULL, flags); | |||||
vdev_label_write(zio, vd, 0, pad2, | |||||
offsetof(vdev_label_t, vl_pad2), | |||||
VDEV_PAD_SIZE, NULL, NULL, flags); | |||||
error = zio_wait(zio); | |||||
if (error != 0 && !(flags & ZIO_FLAG_TRYHARD)) { | |||||
flags |= ZIO_FLAG_TRYHARD; | |||||
goto retry; | |||||
} | |||||
zio_buf_free(pad2, VDEV_PAD_SIZE); | |||||
return (error); | |||||
} | |||||
/* | /* | ||||
* ========================================================================== | * ========================================================================== | ||||
* uberblock load/sync | * uberblock load/sync | ||||
* ========================================================================== | * ========================================================================== | ||||
*/ | */ | ||||
/* | /* | ||||
* Consider the following situation: txg is safely synced to disk. We've | * Consider the following situation: txg is safely synced to disk. We've | ||||
▲ Show 20 Lines • Show All 431 Lines • Show Last 20 Lines |