spa.c (228103) | spa.c (230514) |
---|---|
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 | 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++) | 1076 for (i = 0; i < spa->spa_l2cache.sav_count; i++) { 1077 vdev_clear_stats(spa->spa_l2cache.sav_vdevs[i]); |
1077 vdev_free(spa->spa_l2cache.sav_vdevs[i]); | 1078 vdev_free(spa->spa_l2cache.sav_vdevs[i]); |
1079 } |
|
1078 if (spa->spa_l2cache.sav_vdevs) { 1079 kmem_free(spa->spa_l2cache.sav_vdevs, 1080 spa->spa_l2cache.sav_count * sizeof (void *)); 1081 spa->spa_l2cache.sav_vdevs = NULL; 1082 } 1083 if (spa->spa_l2cache.sav_config) { 1084 nvlist_free(spa->spa_l2cache.sav_config); 1085 spa->spa_l2cache.sav_config = NULL; --- 211 unchanged lines hidden (view full) --- 1297 /* 1298 * Purge vdevs that were dropped 1299 */ 1300 for (i = 0; i < oldnvdevs; i++) { 1301 uint64_t pool; 1302 1303 vd = oldvdevs[i]; 1304 if (vd != NULL) { | 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 |
|
1305 if (spa_l2cache_exists(vd->vdev_guid, &pool) && 1306 pool != 0ULL && l2arc_vdev_present(vd)) 1307 l2arc_remove_vdev(vd); | 1309 if (spa_l2cache_exists(vd->vdev_guid, &pool) && 1310 pool != 0ULL && l2arc_vdev_present(vd)) 1311 l2arc_remove_vdev(vd); |
1308 (void) vdev_close(vd); 1309 spa_l2cache_remove(vd); | 1312 vdev_clear_stats(vd); 1313 vdev_free(vd); |
1310 } 1311 } 1312 1313 if (oldvdevs) 1314 kmem_free(oldvdevs, oldnvdevs * sizeof (void *)); 1315 1316 if (sav->sav_config == NULL) 1317 goto out; --- 626 unchanged lines hidden (view full) --- 1944 * the vdev config. 1945 * 1946 * If we're assembling a new pool that's been split off from an 1947 * existing pool, the labels haven't yet been updated so we skip 1948 * validation for now. 1949 */ 1950 if (type != SPA_IMPORT_ASSEMBLE) { 1951 spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); | 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); |
1952 error = vdev_validate(rvd); | 1956 error = vdev_validate(rvd, mosconfig); |
1953 spa_config_exit(spa, SCL_ALL, FTAG); 1954 1955 if (error != 0) 1956 return (error); 1957 1958 if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) 1959 return (ENXIO); 1960 } --- 852 unchanged lines hidden (view full) --- 2813 /* 2814 * The L2ARC currently only supports disk devices in 2815 * kernel context. For user-level testing, we allow it. 2816 */ 2817#ifdef _KERNEL 2818 if ((strcmp(config, ZPOOL_CONFIG_L2CACHE) == 0) && 2819 strcmp(vd->vdev_ops->vdev_op_type, VDEV_TYPE_DISK) != 0) { 2820 error = ENOTBLK; | 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); |
|
2821 goto out; 2822 } 2823#endif 2824 vd->vdev_top = vd; 2825 2826 if ((error = vdev_open(vd)) == 0 && 2827 (error = vdev_label_init(vd, crtxg, label)) == 0) { 2828 VERIFY(nvlist_add_uint64(dev[i], ZPOOL_CONFIG_GUID, --- 93 unchanged lines hidden (view full) --- 2922 uint64_t pool; 2923 2924 vd = sav->sav_vdevs[i]; 2925 ASSERT(vd != NULL); 2926 2927 if (spa_l2cache_exists(vd->vdev_guid, &pool) && 2928 pool != 0ULL && l2arc_vdev_present(vd)) 2929 l2arc_remove_vdev(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); |
2930 if (vd->vdev_isl2cache) 2931 spa_l2cache_remove(vd); 2932 vdev_clear_stats(vd); 2933 (void) vdev_close(vd); | |
2934 } 2935} 2936 2937/* 2938 * Pool Creation 2939 */ 2940int 2941spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props, --- 982 unchanged lines hidden (view full) --- 3924 return (spa_vdev_exit(spa, NULL, txg, ENODEV)); 3925 3926 if (!oldvd->vdev_ops->vdev_op_leaf) 3927 return (spa_vdev_exit(spa, NULL, txg, ENOTSUP)); 3928 3929 pvd = oldvd->vdev_parent; 3930 3931 if ((error = spa_config_parse(spa, &newrootvd, nvroot, NULL, 0, | 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, |
3932 VDEV_ALLOC_ADD)) != 0) | 3933 VDEV_ALLOC_ATTACH)) != 0) |
3933 return (spa_vdev_exit(spa, NULL, txg, EINVAL)); 3934 3935 if (newrootvd->vdev_children != 1) 3936 return (spa_vdev_exit(spa, newrootvd, txg, EINVAL)); 3937 3938 newvd = newrootvd->vdev_child[0]; 3939 3940 if (!newvd->vdev_ops->vdev_op_leaf) --- 2077 unchanged lines hidden --- | 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 --- |