Deleted Added
sdiff udiff text old ( 228103 ) new ( 230514 )
full compact
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 1059 unchanged lines hidden (view full) ---

1068 spa->spa_spares.sav_vdevs = NULL;
1069 }
1070 if (spa->spa_spares.sav_config) {
1071 nvlist_free(spa->spa_spares.sav_config);
1072 spa->spa_spares.sav_config = NULL;
1073 }
1074 spa->spa_spares.sav_count = 0;
1075
1076 for (i = 0; i < spa->spa_l2cache.sav_count; i++) {
1077 vdev_clear_stats(spa->spa_l2cache.sav_vdevs[i]);
1078 vdev_free(spa->spa_l2cache.sav_vdevs[i]);
1079 }
1080 if (spa->spa_l2cache.sav_vdevs) {
1081 kmem_free(spa->spa_l2cache.sav_vdevs,
1082 spa->spa_l2cache.sav_count * sizeof (void *));
1083 spa->spa_l2cache.sav_vdevs = NULL;
1084 }
1085 if (spa->spa_l2cache.sav_config) {
1086 nvlist_free(spa->spa_l2cache.sav_config);
1087 spa->spa_l2cache.sav_config = NULL;

--- 211 unchanged lines hidden (view full) ---

1299 /*
1300 * Purge vdevs that were dropped
1301 */
1302 for (i = 0; i < oldnvdevs; i++) {
1303 uint64_t pool;
1304
1305 vd = oldvdevs[i];
1306 if (vd != NULL) {
1307 ASSERT(vd->vdev_isl2cache);
1308
1309 if (spa_l2cache_exists(vd->vdev_guid, &pool) &&
1310 pool != 0ULL && l2arc_vdev_present(vd))
1311 l2arc_remove_vdev(vd);
1312 vdev_clear_stats(vd);
1313 vdev_free(vd);
1314 }
1315 }
1316
1317 if (oldvdevs)
1318 kmem_free(oldvdevs, oldnvdevs * sizeof (void *));
1319
1320 if (sav->sav_config == NULL)
1321 goto out;

--- 626 unchanged lines hidden (view full) ---

1948 * the vdev config.
1949 *
1950 * If we're assembling a new pool that's been split off from an
1951 * existing pool, the labels haven't yet been updated so we skip
1952 * validation for now.
1953 */
1954 if (type != SPA_IMPORT_ASSEMBLE) {
1955 spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
1956 error = vdev_validate(rvd, mosconfig);
1957 spa_config_exit(spa, SCL_ALL, FTAG);
1958
1959 if (error != 0)
1960 return (error);
1961
1962 if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN)
1963 return (ENXIO);
1964 }

--- 852 unchanged lines hidden (view full) ---

2817 /*
2818 * The L2ARC currently only supports disk devices in
2819 * kernel context. For user-level testing, we allow it.
2820 */
2821#ifdef _KERNEL
2822 if ((strcmp(config, ZPOOL_CONFIG_L2CACHE) == 0) &&
2823 strcmp(vd->vdev_ops->vdev_op_type, VDEV_TYPE_DISK) != 0) {
2824 error = ENOTBLK;
2825 vdev_free(vd);
2826 goto out;
2827 }
2828#endif
2829 vd->vdev_top = vd;
2830
2831 if ((error = vdev_open(vd)) == 0 &&
2832 (error = vdev_label_init(vd, crtxg, label)) == 0) {
2833 VERIFY(nvlist_add_uint64(dev[i], ZPOOL_CONFIG_GUID,

--- 93 unchanged lines hidden (view full) ---

2927 uint64_t pool;
2928
2929 vd = sav->sav_vdevs[i];
2930 ASSERT(vd != NULL);
2931
2932 if (spa_l2cache_exists(vd->vdev_guid, &pool) &&
2933 pool != 0ULL && l2arc_vdev_present(vd))
2934 l2arc_remove_vdev(vd);
2935 }
2936}
2937
2938/*
2939 * Pool Creation
2940 */
2941int
2942spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,

--- 982 unchanged lines hidden (view full) ---

3925 return (spa_vdev_exit(spa, NULL, txg, ENODEV));
3926
3927 if (!oldvd->vdev_ops->vdev_op_leaf)
3928 return (spa_vdev_exit(spa, NULL, txg, ENOTSUP));
3929
3930 pvd = oldvd->vdev_parent;
3931
3932 if ((error = spa_config_parse(spa, &newrootvd, nvroot, NULL, 0,
3933 VDEV_ALLOC_ATTACH)) != 0)
3934 return (spa_vdev_exit(spa, NULL, txg, EINVAL));
3935
3936 if (newrootvd->vdev_children != 1)
3937 return (spa_vdev_exit(spa, newrootvd, txg, EINVAL));
3938
3939 newvd = newrootvd->vdev_child[0];
3940
3941 if (!newvd->vdev_ops->vdev_op_leaf)

--- 2077 unchanged lines hidden ---