959 * It's possible that the best uberblock was discovered on a label
960 * that has a configuration which was written in a future txg.
961 * Search all labels on this vdev to find the configuration that
962 * matches the txg for our uberblock.
963 */
964 if (cb.ubl_vd != NULL)
965 *config = vdev_label_read_config(cb.ubl_vd, ub->ub_txg);
966 spa_config_exit(spa, SCL_ALL, FTAG);
967 }
968
969 /*
970 * On success, increment root zio's count of good writes.
971 * We only get credit for writes to known-visible vdevs; see spa_vdev_add().
972 */
973 static void
974 vdev_uberblock_sync_done(zio_t *zio)
975 {
976 uint64_t *good_writes = zio->io_private;
977
978 if (zio->io_error == 0 && zio->io_vd->vdev_top->vdev_ms_array != 0)
979 atomic_add_64(good_writes, 1);
980 }
981
982 /*
983 * Write the uberblock to all labels of all leaves of the specified vdev.
984 */
985 static void
986 vdev_uberblock_sync(zio_t *zio, uberblock_t *ub, vdev_t *vd, int flags)
987 {
988 uberblock_t *ubbuf;
989 int n;
990
991 for (int c = 0; c < vd->vdev_children; c++)
992 vdev_uberblock_sync(zio, ub, vd->vdev_child[c], flags);
993
994 if (!vd->vdev_ops->vdev_op_leaf)
995 return;
996
997 if (!vdev_writeable(vd))
998 return;
999
1034 */
1035 zio = zio_root(spa, NULL, NULL, flags);
1036
1037 for (int v = 0; v < svdcount; v++)
1038 zio_flush(zio, svd[v]);
1039
1040 (void) zio_wait(zio);
1041
1042 return (good_writes >= 1 ? 0 : EIO);
1043 }
1044
1045 /*
1046 * On success, increment the count of good writes for our top-level vdev.
1047 */
1048 static void
1049 vdev_label_sync_done(zio_t *zio)
1050 {
1051 uint64_t *good_writes = zio->io_private;
1052
1053 if (zio->io_error == 0)
1054 atomic_add_64(good_writes, 1);
1055 }
1056
1057 /*
1058 * If there weren't enough good writes, indicate failure to the parent.
1059 */
1060 static void
1061 vdev_label_sync_top_done(zio_t *zio)
1062 {
1063 uint64_t *good_writes = zio->io_private;
1064
1065 if (*good_writes == 0)
1066 zio->io_error = SET_ERROR(EIO);
1067
1068 kmem_free(good_writes, sizeof (uint64_t));
1069 }
1070
1071 /*
1072 * We ignore errors for log and cache devices, simply free the private data.
1073 */
1074 static void
|
959 * It's possible that the best uberblock was discovered on a label
960 * that has a configuration which was written in a future txg.
961 * Search all labels on this vdev to find the configuration that
962 * matches the txg for our uberblock.
963 */
964 if (cb.ubl_vd != NULL)
965 *config = vdev_label_read_config(cb.ubl_vd, ub->ub_txg);
966 spa_config_exit(spa, SCL_ALL, FTAG);
967 }
968
969 /*
970 * On success, increment root zio's count of good writes.
971 * We only get credit for writes to known-visible vdevs; see spa_vdev_add().
972 */
973 static void
974 vdev_uberblock_sync_done(zio_t *zio)
975 {
976 uint64_t *good_writes = zio->io_private;
977
978 if (zio->io_error == 0 && zio->io_vd->vdev_top->vdev_ms_array != 0)
979 atomic_inc_64(good_writes);
980 }
981
982 /*
983 * Write the uberblock to all labels of all leaves of the specified vdev.
984 */
985 static void
986 vdev_uberblock_sync(zio_t *zio, uberblock_t *ub, vdev_t *vd, int flags)
987 {
988 uberblock_t *ubbuf;
989 int n;
990
991 for (int c = 0; c < vd->vdev_children; c++)
992 vdev_uberblock_sync(zio, ub, vd->vdev_child[c], flags);
993
994 if (!vd->vdev_ops->vdev_op_leaf)
995 return;
996
997 if (!vdev_writeable(vd))
998 return;
999
1034 */
1035 zio = zio_root(spa, NULL, NULL, flags);
1036
1037 for (int v = 0; v < svdcount; v++)
1038 zio_flush(zio, svd[v]);
1039
1040 (void) zio_wait(zio);
1041
1042 return (good_writes >= 1 ? 0 : EIO);
1043 }
1044
1045 /*
1046 * On success, increment the count of good writes for our top-level vdev.
1047 */
1048 static void
1049 vdev_label_sync_done(zio_t *zio)
1050 {
1051 uint64_t *good_writes = zio->io_private;
1052
1053 if (zio->io_error == 0)
1054 atomic_inc_64(good_writes);
1055 }
1056
1057 /*
1058 * If there weren't enough good writes, indicate failure to the parent.
1059 */
1060 static void
1061 vdev_label_sync_top_done(zio_t *zio)
1062 {
1063 uint64_t *good_writes = zio->io_private;
1064
1065 if (*good_writes == 0)
1066 zio->io_error = SET_ERROR(EIO);
1067
1068 kmem_free(good_writes, sizeof (uint64_t));
1069 }
1070
1071 /*
1072 * We ignore errors for log and cache devices, simply free the private data.
1073 */
1074 static void
|