1011 return;
1012
1013 if (!vdev_writeable(vd))
1014 return;
1015
1016 n = ub->ub_txg & (VDEV_UBERBLOCK_COUNT(vd) - 1);
1017
1018 ubbuf = zio_buf_alloc(VDEV_UBERBLOCK_SIZE(vd));
1019 bzero(ubbuf, VDEV_UBERBLOCK_SIZE(vd));
1020 *ubbuf = *ub;
1021
1022 for (int l = 0; l < VDEV_LABELS; l++)
1023 vdev_label_write(zio, vd, l, ubbuf,
1024 VDEV_UBERBLOCK_OFFSET(vd, n), VDEV_UBERBLOCK_SIZE(vd),
1025 vdev_uberblock_sync_done, zio->io_private,
1026 flags | ZIO_FLAG_DONT_PROPAGATE);
1027
1028 zio_buf_free(ubbuf, VDEV_UBERBLOCK_SIZE(vd));
1029 }
1030
1031 int
1032 vdev_uberblock_sync_list(vdev_t **svd, int svdcount, uberblock_t *ub, int flags)
1033 {
1034 spa_t *spa = svd[0]->vdev_spa;
1035 zio_t *zio;
1036 uint64_t good_writes = 0;
1037
1038 zio = zio_root(spa, NULL, &good_writes, flags);
1039
1040 for (int v = 0; v < svdcount; v++)
1041 vdev_uberblock_sync(zio, ub, svd[v], flags);
1042
1043 (void) zio_wait(zio);
1044
1045 /*
1046 * Flush the uberblocks to disk. This ensures that the odd labels
1047 * are no longer needed (because the new uberblocks and the even
1048 * labels are safely on disk), so it is safe to overwrite them.
1049 */
1050 zio = zio_root(spa, NULL, NULL, flags);
|
1011 return;
1012
1013 if (!vdev_writeable(vd))
1014 return;
1015
1016 n = ub->ub_txg & (VDEV_UBERBLOCK_COUNT(vd) - 1);
1017
1018 ubbuf = zio_buf_alloc(VDEV_UBERBLOCK_SIZE(vd));
1019 bzero(ubbuf, VDEV_UBERBLOCK_SIZE(vd));
1020 *ubbuf = *ub;
1021
1022 for (int l = 0; l < VDEV_LABELS; l++)
1023 vdev_label_write(zio, vd, l, ubbuf,
1024 VDEV_UBERBLOCK_OFFSET(vd, n), VDEV_UBERBLOCK_SIZE(vd),
1025 vdev_uberblock_sync_done, zio->io_private,
1026 flags | ZIO_FLAG_DONT_PROPAGATE);
1027
1028 zio_buf_free(ubbuf, VDEV_UBERBLOCK_SIZE(vd));
1029 }
1030
1031 /* Sync the uberblocks to all vdevs in svd[] */
1032 int
1033 vdev_uberblock_sync_list(vdev_t **svd, int svdcount, uberblock_t *ub, int flags)
1034 {
1035 spa_t *spa = svd[0]->vdev_spa;
1036 zio_t *zio;
1037 uint64_t good_writes = 0;
1038
1039 zio = zio_root(spa, NULL, &good_writes, flags);
1040
1041 for (int v = 0; v < svdcount; v++)
1042 vdev_uberblock_sync(zio, ub, svd[v], flags);
1043
1044 (void) zio_wait(zio);
1045
1046 /*
1047 * Flush the uberblocks to disk. This ensures that the odd labels
1048 * are no longer needed (because the new uberblocks and the even
1049 * labels are safely on disk), so it is safe to overwrite them.
1050 */
1051 zio = zio_root(spa, NULL, NULL, flags);
|