Lines Matching +defs:label +defs:offset

31  * The vdev label serves several distinct purposes:
49 * label, it only consumes the information in the first three cases. The
57 * Before describing the contents of the label, it's important to understand how
74 * the same transaction group (10). Each label is mirrored and checksummed, so
75 * that we can detect when we fail partway through writing the label.
80 * 1. For each vdev, update 'L1' to the new label
82 * 3. For each vdev, update 'L2' to the new label
84 * Given arbitrary failure, we can determine the correct label to use based on
91 * Another added complexity is that not every label is updated when the config
93 * every label for every device in the pool. This means that both L1 and L2 may
101 * The vdev label consists of two distinct parts, and is wrapped within the
102 * vdev_label_t structure. The label includes 8k of padding to permit legacy
105 * The first half of the label is a packed nvlist which contains pool wide
109 * The latter half of the label consists of a redundant array of uberblocks.
123 * txg Transaction group in which this label was written
129 * Each leaf device label also contains the following:
157 * Basic routines to read and write from a vdev label.
161 vdev_label_offset(uint64_t psize, int l, uint64_t offset)
163 ASSERT(offset < sizeof (vdev_label_t));
166 return (offset + l * sizeof (vdev_label_t) + (l < VDEV_LABELS / 2 ?
171 * Returns back the vdev label associated with the passed in offset.
174 vdev_label_number(uint64_t psize, uint64_t offset)
178 if (offset >= psize - VDEV_LABEL_END_SIZE) {
179 offset -= psize - VDEV_LABEL_END_SIZE;
180 offset += (VDEV_LABELS / 2) * sizeof (vdev_label_t);
182 l = offset / sizeof (vdev_label_t);
187 vdev_label_read(zio_t *zio, vdev_t *vd, int l, void *buf, uint64_t offset,
195 vdev_label_offset(vd->vdev_psize, l, offset),
201 vdev_label_write(zio_t *zio, vdev_t *vd, int l, void *buf, uint64_t offset,
211 vdev_label_offset(vd->vdev_psize, l, offset),
440 * Returns the configuration from the label of the given vdev. For vdevs
441 * which don't have a txg value stored on their label (i.e. spares/cache)
443 * the configuration from the first valid label we find. Otherwise,
444 * find the most up-to-date label that does not exceed the specified
468 nvlist_t *label = NULL;
478 &label, 0) == 0) {
485 * configuration from the first valid label we
488 error = nvlist_lookup_uint64(label,
491 config = label;
496 config = fnvlist_dup(label);
500 if (label != NULL) {
501 nvlist_free(label);
502 label = NULL;
527 nvlist_t *label;
535 * Read the label, if any, and perform some basic sanity checks.
537 if ((label = vdev_label_read_config(vd, -1ULL)) == NULL)
540 (void) nvlist_lookup_uint64(label, ZPOOL_CONFIG_CREATE_TXG,
543 if (nvlist_lookup_uint64(label, ZPOOL_CONFIG_POOL_STATE,
545 nvlist_lookup_uint64(label, ZPOOL_CONFIG_GUID,
547 nvlist_free(label);
552 (nvlist_lookup_uint64(label, ZPOOL_CONFIG_POOL_GUID,
554 nvlist_lookup_uint64(label, ZPOOL_CONFIG_POOL_TXG,
556 nvlist_free(label);
560 nvlist_free(label);
575 * unused) label. This is only an error if the create transaction
632 * Initialize a vdev label. We check to make sure each leaf device is not in
633 * use, and writable. We put down an initial label which we will later
634 * overwrite with a complete label. Note that it's important to do this
643 nvlist_t *label;
737 * Initialize its label.
743 * Generate a label describing the pool and our top-level vdev.
751 * For inactive hot spares, we generate a special label that
753 * label if we are adding a hot spare, or if we are removing an
757 VERIFY(nvlist_alloc(&label, NV_UNIQUE_NAME, KM_SLEEP) == 0);
759 VERIFY(nvlist_add_uint64(label, ZPOOL_CONFIG_VERSION,
761 VERIFY(nvlist_add_uint64(label, ZPOOL_CONFIG_POOL_STATE,
763 VERIFY(nvlist_add_uint64(label, ZPOOL_CONFIG_GUID,
768 * For level 2 ARC devices, add a special label.
770 VERIFY(nvlist_alloc(&label, NV_UNIQUE_NAME, KM_SLEEP) == 0);
772 VERIFY(nvlist_add_uint64(label, ZPOOL_CONFIG_VERSION,
774 VERIFY(nvlist_add_uint64(label, ZPOOL_CONFIG_POOL_STATE,
776 VERIFY(nvlist_add_uint64(label, ZPOOL_CONFIG_GUID,
783 label = spa_config_generate(spa, vd, txg, B_FALSE);
790 VERIFY(nvlist_add_uint64(label, ZPOOL_CONFIG_CREATE_TXG,
797 error = nvlist_pack(label, &buf, &buflen, NV_ENCODE_XDR, KM_SLEEP);
799 nvlist_free(label);
850 nvlist_free(label);
1001 * configuration. First, we read the uberblock array of each label of each
1029 * It's possible that the best uberblock was discovered on a label
1156 nvlist_t *label;
1171 * Generate a label describing the top-level config to which we belong.
1173 label = spa_config_generate(vd->vdev_spa, vd, txg, B_FALSE);
1181 if (nvlist_pack(label, &buf, &buflen, NV_ENCODE_XDR, KM_SLEEP) == 0) {
1192 nvlist_free(label);
1260 * Normally, we don't want to try too hard to write every label and
1263 * single label out, we should retry with ZIO_FLAG_TRYHARD before
1310 * the new labels to disk to ensure that all even-label updates
1341 * to disk to ensure that all odd-label updates are committed to