ztest.c (242845) | ztest.c (243505) |
---|---|
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 --- 316 unchanged lines hidden (view full) --- 325ztest_func_t ztest_scrub; 326ztest_func_t ztest_dsl_dataset_promote_busy; 327ztest_func_t ztest_vdev_attach_detach; 328ztest_func_t ztest_vdev_LUN_growth; 329ztest_func_t ztest_vdev_add_remove; 330ztest_func_t ztest_vdev_aux_add_remove; 331ztest_func_t ztest_split_pool; 332ztest_func_t ztest_reguid; | 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 --- 316 unchanged lines hidden (view full) --- 325ztest_func_t ztest_scrub; 326ztest_func_t ztest_dsl_dataset_promote_busy; 327ztest_func_t ztest_vdev_attach_detach; 328ztest_func_t ztest_vdev_LUN_growth; 329ztest_func_t ztest_vdev_add_remove; 330ztest_func_t ztest_vdev_aux_add_remove; 331ztest_func_t ztest_split_pool; 332ztest_func_t ztest_reguid; |
333ztest_func_t ztest_spa_upgrade; |
|
333 334uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */ 335uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */ 336uint64_t zopt_often = 1ULL * NANOSEC; /* every second */ 337uint64_t zopt_sometimes = 10ULL * NANOSEC; /* every 10 seconds */ 338uint64_t zopt_rarely = 60ULL * NANOSEC; /* every 60 seconds */ 339 340ztest_info_t ztest_info[] = { --- 17 unchanged lines hidden (view full) --- 358 { ztest_dmu_snapshot_create_destroy, 1, &zopt_sometimes }, 359 { ztest_spa_create_destroy, 1, &zopt_sometimes }, 360 { ztest_fault_inject, 1, &zopt_sometimes }, 361 { ztest_ddt_repair, 1, &zopt_sometimes }, 362 { ztest_dmu_snapshot_hold, 1, &zopt_sometimes }, 363 { ztest_reguid, 1, &zopt_sometimes }, 364 { ztest_spa_rename, 1, &zopt_rarely }, 365 { ztest_scrub, 1, &zopt_rarely }, | 334 335uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */ 336uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */ 337uint64_t zopt_often = 1ULL * NANOSEC; /* every second */ 338uint64_t zopt_sometimes = 10ULL * NANOSEC; /* every 10 seconds */ 339uint64_t zopt_rarely = 60ULL * NANOSEC; /* every 60 seconds */ 340 341ztest_info_t ztest_info[] = { --- 17 unchanged lines hidden (view full) --- 359 { ztest_dmu_snapshot_create_destroy, 1, &zopt_sometimes }, 360 { ztest_spa_create_destroy, 1, &zopt_sometimes }, 361 { ztest_fault_inject, 1, &zopt_sometimes }, 362 { ztest_ddt_repair, 1, &zopt_sometimes }, 363 { ztest_dmu_snapshot_hold, 1, &zopt_sometimes }, 364 { ztest_reguid, 1, &zopt_sometimes }, 365 { ztest_spa_rename, 1, &zopt_rarely }, 366 { ztest_scrub, 1, &zopt_rarely }, |
367 { ztest_spa_upgrade, 1, &zopt_rarely }, |
|
366 { ztest_dsl_dataset_promote_busy, 1, &zopt_rarely }, 367 { ztest_vdev_attach_detach, 1, &zopt_rarely }, 368 { ztest_vdev_LUN_growth, 1, &zopt_rarely }, 369 { ztest_vdev_add_remove, 1, 370 &ztest_opts.zo_vdevtime }, 371 { ztest_vdev_aux_add_remove, 1, 372 &ztest_opts.zo_vdevtime }, 373}; --- 418 unchanged lines hidden (view full) --- 792ztest_get_ashift(void) 793{ 794 if (ztest_opts.zo_ashift == 0) 795 return (SPA_MINBLOCKSHIFT + ztest_random(3)); 796 return (ztest_opts.zo_ashift); 797} 798 799static nvlist_t * | 368 { ztest_dsl_dataset_promote_busy, 1, &zopt_rarely }, 369 { ztest_vdev_attach_detach, 1, &zopt_rarely }, 370 { ztest_vdev_LUN_growth, 1, &zopt_rarely }, 371 { ztest_vdev_add_remove, 1, 372 &ztest_opts.zo_vdevtime }, 373 { ztest_vdev_aux_add_remove, 1, 374 &ztest_opts.zo_vdevtime }, 375}; --- 418 unchanged lines hidden (view full) --- 794ztest_get_ashift(void) 795{ 796 if (ztest_opts.zo_ashift == 0) 797 return (SPA_MINBLOCKSHIFT + ztest_random(3)); 798 return (ztest_opts.zo_ashift); 799} 800 801static nvlist_t * |
800make_vdev_file(char *path, char *aux, size_t size, uint64_t ashift) | 802make_vdev_file(char *path, char *aux, char *pool, size_t size, uint64_t ashift) |
801{ 802 char pathbuf[MAXPATHLEN]; 803 uint64_t vdev; 804 nvlist_t *file; 805 806 if (ashift == 0) 807 ashift = ztest_get_ashift(); 808 809 if (path == NULL) { 810 path = pathbuf; 811 812 if (aux != NULL) { 813 vdev = ztest_shared->zs_vdev_aux; 814 (void) snprintf(path, sizeof (pathbuf), 815 ztest_aux_template, ztest_opts.zo_dir, | 803{ 804 char pathbuf[MAXPATHLEN]; 805 uint64_t vdev; 806 nvlist_t *file; 807 808 if (ashift == 0) 809 ashift = ztest_get_ashift(); 810 811 if (path == NULL) { 812 path = pathbuf; 813 814 if (aux != NULL) { 815 vdev = ztest_shared->zs_vdev_aux; 816 (void) snprintf(path, sizeof (pathbuf), 817 ztest_aux_template, ztest_opts.zo_dir, |
816 ztest_opts.zo_pool, aux, vdev); | 818 pool == NULL ? ztest_opts.zo_pool : pool, 819 aux, vdev); |
817 } else { 818 vdev = ztest_shared->zs_vdev_next_leaf++; 819 (void) snprintf(path, sizeof (pathbuf), 820 ztest_dev_template, ztest_opts.zo_dir, | 820 } else { 821 vdev = ztest_shared->zs_vdev_next_leaf++; 822 (void) snprintf(path, sizeof (pathbuf), 823 ztest_dev_template, ztest_opts.zo_dir, |
821 ztest_opts.zo_pool, vdev); | 824 pool == NULL ? ztest_opts.zo_pool : pool, vdev); |
822 } 823 } 824 825 if (size != 0) { 826 int fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0666); 827 if (fd == -1) 828 fatal(1, "can't open %s", path); 829 if (ftruncate(fd, size) != 0) --- 5 unchanged lines hidden (view full) --- 835 VERIFY(nvlist_add_string(file, ZPOOL_CONFIG_TYPE, VDEV_TYPE_FILE) == 0); 836 VERIFY(nvlist_add_string(file, ZPOOL_CONFIG_PATH, path) == 0); 837 VERIFY(nvlist_add_uint64(file, ZPOOL_CONFIG_ASHIFT, ashift) == 0); 838 839 return (file); 840} 841 842static nvlist_t * | 825 } 826 } 827 828 if (size != 0) { 829 int fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0666); 830 if (fd == -1) 831 fatal(1, "can't open %s", path); 832 if (ftruncate(fd, size) != 0) --- 5 unchanged lines hidden (view full) --- 838 VERIFY(nvlist_add_string(file, ZPOOL_CONFIG_TYPE, VDEV_TYPE_FILE) == 0); 839 VERIFY(nvlist_add_string(file, ZPOOL_CONFIG_PATH, path) == 0); 840 VERIFY(nvlist_add_uint64(file, ZPOOL_CONFIG_ASHIFT, ashift) == 0); 841 842 return (file); 843} 844 845static nvlist_t * |
843make_vdev_raidz(char *path, char *aux, size_t size, uint64_t ashift, int r) | 846make_vdev_raidz(char *path, char *aux, char *pool, size_t size, 847 uint64_t ashift, int r) |
844{ 845 nvlist_t *raidz, **child; 846 int c; 847 848 if (r < 2) | 848{ 849 nvlist_t *raidz, **child; 850 int c; 851 852 if (r < 2) |
849 return (make_vdev_file(path, aux, size, ashift)); | 853 return (make_vdev_file(path, aux, pool, size, ashift)); |
850 child = umem_alloc(r * sizeof (nvlist_t *), UMEM_NOFAIL); 851 852 for (c = 0; c < r; c++) | 854 child = umem_alloc(r * sizeof (nvlist_t *), UMEM_NOFAIL); 855 856 for (c = 0; c < r; c++) |
853 child[c] = make_vdev_file(path, aux, size, ashift); | 857 child[c] = make_vdev_file(path, aux, pool, size, ashift); |
854 855 VERIFY(nvlist_alloc(&raidz, NV_UNIQUE_NAME, 0) == 0); 856 VERIFY(nvlist_add_string(raidz, ZPOOL_CONFIG_TYPE, 857 VDEV_TYPE_RAIDZ) == 0); 858 VERIFY(nvlist_add_uint64(raidz, ZPOOL_CONFIG_NPARITY, 859 ztest_opts.zo_raidz_parity) == 0); 860 VERIFY(nvlist_add_nvlist_array(raidz, ZPOOL_CONFIG_CHILDREN, 861 child, r) == 0); 862 863 for (c = 0; c < r; c++) 864 nvlist_free(child[c]); 865 866 umem_free(child, r * sizeof (nvlist_t *)); 867 868 return (raidz); 869} 870 871static nvlist_t * | 858 859 VERIFY(nvlist_alloc(&raidz, NV_UNIQUE_NAME, 0) == 0); 860 VERIFY(nvlist_add_string(raidz, ZPOOL_CONFIG_TYPE, 861 VDEV_TYPE_RAIDZ) == 0); 862 VERIFY(nvlist_add_uint64(raidz, ZPOOL_CONFIG_NPARITY, 863 ztest_opts.zo_raidz_parity) == 0); 864 VERIFY(nvlist_add_nvlist_array(raidz, ZPOOL_CONFIG_CHILDREN, 865 child, r) == 0); 866 867 for (c = 0; c < r; c++) 868 nvlist_free(child[c]); 869 870 umem_free(child, r * sizeof (nvlist_t *)); 871 872 return (raidz); 873} 874 875static nvlist_t * |
872make_vdev_mirror(char *path, char *aux, size_t size, uint64_t ashift, 873 int r, int m) | 876make_vdev_mirror(char *path, char *aux, char *pool, size_t size, 877 uint64_t ashift, int r, int m) |
874{ 875 nvlist_t *mirror, **child; 876 int c; 877 878 if (m < 1) | 878{ 879 nvlist_t *mirror, **child; 880 int c; 881 882 if (m < 1) |
879 return (make_vdev_raidz(path, aux, size, ashift, r)); | 883 return (make_vdev_raidz(path, aux, pool, size, ashift, r)); |
880 881 child = umem_alloc(m * sizeof (nvlist_t *), UMEM_NOFAIL); 882 883 for (c = 0; c < m; c++) | 884 885 child = umem_alloc(m * sizeof (nvlist_t *), UMEM_NOFAIL); 886 887 for (c = 0; c < m; c++) |
884 child[c] = make_vdev_raidz(path, aux, size, ashift, r); | 888 child[c] = make_vdev_raidz(path, aux, pool, size, ashift, r); |
885 886 VERIFY(nvlist_alloc(&mirror, NV_UNIQUE_NAME, 0) == 0); 887 VERIFY(nvlist_add_string(mirror, ZPOOL_CONFIG_TYPE, 888 VDEV_TYPE_MIRROR) == 0); 889 VERIFY(nvlist_add_nvlist_array(mirror, ZPOOL_CONFIG_CHILDREN, 890 child, m) == 0); 891 892 for (c = 0; c < m; c++) 893 nvlist_free(child[c]); 894 895 umem_free(child, m * sizeof (nvlist_t *)); 896 897 return (mirror); 898} 899 900static nvlist_t * | 889 890 VERIFY(nvlist_alloc(&mirror, NV_UNIQUE_NAME, 0) == 0); 891 VERIFY(nvlist_add_string(mirror, ZPOOL_CONFIG_TYPE, 892 VDEV_TYPE_MIRROR) == 0); 893 VERIFY(nvlist_add_nvlist_array(mirror, ZPOOL_CONFIG_CHILDREN, 894 child, m) == 0); 895 896 for (c = 0; c < m; c++) 897 nvlist_free(child[c]); 898 899 umem_free(child, m * sizeof (nvlist_t *)); 900 901 return (mirror); 902} 903 904static nvlist_t * |
901make_vdev_root(char *path, char *aux, size_t size, uint64_t ashift, 902 int log, int r, int m, int t) | 905make_vdev_root(char *path, char *aux, char *pool, size_t size, uint64_t ashift, 906 int log, int r, int m, int t) |
903{ 904 nvlist_t *root, **child; 905 int c; 906 907 ASSERT(t > 0); 908 909 child = umem_alloc(t * sizeof (nvlist_t *), UMEM_NOFAIL); 910 911 for (c = 0; c < t; c++) { | 907{ 908 nvlist_t *root, **child; 909 int c; 910 911 ASSERT(t > 0); 912 913 child = umem_alloc(t * sizeof (nvlist_t *), UMEM_NOFAIL); 914 915 for (c = 0; c < t; c++) { |
912 child[c] = make_vdev_mirror(path, aux, size, ashift, r, m); | 916 child[c] = make_vdev_mirror(path, aux, pool, size, ashift, 917 r, m); |
913 VERIFY(nvlist_add_uint64(child[c], ZPOOL_CONFIG_IS_LOG, 914 log) == 0); 915 } 916 917 VERIFY(nvlist_alloc(&root, NV_UNIQUE_NAME, 0) == 0); 918 VERIFY(nvlist_add_string(root, ZPOOL_CONFIG_TYPE, VDEV_TYPE_ROOT) == 0); 919 VERIFY(nvlist_add_nvlist_array(root, aux ? aux : ZPOOL_CONFIG_CHILDREN, 920 child, t) == 0); 921 922 for (c = 0; c < t; c++) 923 nvlist_free(child[c]); 924 925 umem_free(child, t * sizeof (nvlist_t *)); 926 927 return (root); 928} 929 | 918 VERIFY(nvlist_add_uint64(child[c], ZPOOL_CONFIG_IS_LOG, 919 log) == 0); 920 } 921 922 VERIFY(nvlist_alloc(&root, NV_UNIQUE_NAME, 0) == 0); 923 VERIFY(nvlist_add_string(root, ZPOOL_CONFIG_TYPE, VDEV_TYPE_ROOT) == 0); 924 VERIFY(nvlist_add_nvlist_array(root, aux ? aux : ZPOOL_CONFIG_CHILDREN, 925 child, t) == 0); 926 927 for (c = 0; c < t; c++) 928 nvlist_free(child[c]); 929 930 umem_free(child, t * sizeof (nvlist_t *)); 931 932 return (root); 933} 934 |
935/* 936 * Find a random spa version. Returns back a random spa version in the 937 * range [initial_version, SPA_VERSION_FEATURES]. 938 */ 939static uint64_t 940ztest_random_spa_version(uint64_t initial_version) 941{ 942 uint64_t version = initial_version; 943 944 if (version <= SPA_VERSION_BEFORE_FEATURES) { 945 version = version + 946 ztest_random(SPA_VERSION_BEFORE_FEATURES - version + 1); 947 } 948 949 if (version > SPA_VERSION_BEFORE_FEATURES) 950 version = SPA_VERSION_FEATURES; 951 952 ASSERT(SPA_VERSION_IS_SUPPORTED(version)); 953 return (version); 954} 955 |
|
930static int 931ztest_random_blocksize(void) 932{ 933 return (1 << (SPA_MINBLOCKSHIFT + 934 ztest_random(SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1))); 935} 936 937static int --- 1326 unchanged lines hidden (view full) --- 2264{ 2265 ztest_shared_opts_t *zo = &ztest_opts; 2266 spa_t *spa; 2267 nvlist_t *nvroot; 2268 2269 /* 2270 * Attempt to create using a bad file. 2271 */ | 956static int 957ztest_random_blocksize(void) 958{ 959 return (1 << (SPA_MINBLOCKSHIFT + 960 ztest_random(SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1))); 961} 962 963static int --- 1326 unchanged lines hidden (view full) --- 2290{ 2291 ztest_shared_opts_t *zo = &ztest_opts; 2292 spa_t *spa; 2293 nvlist_t *nvroot; 2294 2295 /* 2296 * Attempt to create using a bad file. 2297 */ |
2272 nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1); | 2298 nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 0, 1); |
2273 VERIFY3U(ENOENT, ==, 2274 spa_create("ztest_bad_file", nvroot, NULL, NULL, NULL)); 2275 nvlist_free(nvroot); 2276 2277 /* 2278 * Attempt to create using a bad mirror. 2279 */ | 2299 VERIFY3U(ENOENT, ==, 2300 spa_create("ztest_bad_file", nvroot, NULL, NULL, NULL)); 2301 nvlist_free(nvroot); 2302 2303 /* 2304 * Attempt to create using a bad mirror. 2305 */ |
2280 nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 2, 1); | 2306 nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 2, 1); |
2281 VERIFY3U(ENOENT, ==, 2282 spa_create("ztest_bad_mirror", nvroot, NULL, NULL, NULL)); 2283 nvlist_free(nvroot); 2284 2285 /* 2286 * Attempt to create an existing pool. It shouldn't matter 2287 * what's in the nvroot; we should fail with EEXIST. 2288 */ 2289 (void) rw_rdlock(&ztest_name_lock); | 2307 VERIFY3U(ENOENT, ==, 2308 spa_create("ztest_bad_mirror", nvroot, NULL, NULL, NULL)); 2309 nvlist_free(nvroot); 2310 2311 /* 2312 * Attempt to create an existing pool. It shouldn't matter 2313 * what's in the nvroot; we should fail with EEXIST. 2314 */ 2315 (void) rw_rdlock(&ztest_name_lock); |
2290 nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1); | 2316 nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 0, 1); |
2291 VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL)); 2292 nvlist_free(nvroot); 2293 VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG)); 2294 VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool)); 2295 spa_close(spa, FTAG); 2296 2297 (void) rw_unlock(&ztest_name_lock); 2298} 2299 | 2317 VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL)); 2318 nvlist_free(nvroot); 2319 VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG)); 2320 VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool)); 2321 spa_close(spa, FTAG); 2322 2323 (void) rw_unlock(&ztest_name_lock); 2324} 2325 |
2326/* ARGSUSED */ 2327void 2328ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id) 2329{ 2330 spa_t *spa; 2331 uint64_t initial_version = SPA_VERSION_INITIAL; 2332 uint64_t version, newversion; 2333 nvlist_t *nvroot, *props; 2334 char *name; 2335 2336 VERIFY0(mutex_lock(&ztest_vdev_lock)); 2337 name = kmem_asprintf("%s_upgrade", ztest_opts.zo_pool); 2338 2339 /* 2340 * Clean up from previous runs. 2341 */ 2342 (void) spa_destroy(name); 2343 2344 nvroot = make_vdev_root(NULL, NULL, name, ztest_opts.zo_vdev_size, 0, 2345 0, ztest_opts.zo_raidz, ztest_opts.zo_mirrors, 1); 2346 2347 /* 2348 * If we're configuring a RAIDZ device then make sure that the 2349 * the initial version is capable of supporting that feature. 2350 */ 2351 switch (ztest_opts.zo_raidz_parity) { 2352 case 0: 2353 case 1: 2354 initial_version = SPA_VERSION_INITIAL; 2355 break; 2356 case 2: 2357 initial_version = SPA_VERSION_RAIDZ2; 2358 break; 2359 case 3: 2360 initial_version = SPA_VERSION_RAIDZ3; 2361 break; 2362 } 2363 2364 /* 2365 * Create a pool with a spa version that can be upgraded. Pick 2366 * a value between initial_version and SPA_VERSION_BEFORE_FEATURES. 2367 */ 2368 do { 2369 version = ztest_random_spa_version(initial_version); 2370 } while (version > SPA_VERSION_BEFORE_FEATURES); 2371 2372 props = fnvlist_alloc(); 2373 fnvlist_add_uint64(props, 2374 zpool_prop_to_name(ZPOOL_PROP_VERSION), version); 2375 VERIFY0(spa_create(name, nvroot, props, NULL, NULL)); 2376 fnvlist_free(nvroot); 2377 fnvlist_free(props); 2378 2379 VERIFY0(spa_open(name, &spa, FTAG)); 2380 VERIFY3U(spa_version(spa), ==, version); 2381 newversion = ztest_random_spa_version(version + 1); 2382 2383 if (ztest_opts.zo_verbose >= 4) { 2384 (void) printf("upgrading spa version from %llu to %llu\n", 2385 (u_longlong_t)version, (u_longlong_t)newversion); 2386 } 2387 2388 spa_upgrade(spa, newversion); 2389 VERIFY3U(spa_version(spa), >, version); 2390 VERIFY3U(spa_version(spa), ==, fnvlist_lookup_uint64(spa->spa_config, 2391 zpool_prop_to_name(ZPOOL_PROP_VERSION))); 2392 spa_close(spa, FTAG); 2393 2394 strfree(name); 2395 VERIFY0(mutex_unlock(&ztest_vdev_lock)); 2396} 2397 |
|
2300static vdev_t * 2301vdev_lookup_by_path(vdev_t *vd, const char *path) 2302{ 2303 vdev_t *mvd; 2304 2305 if (vd->vdev_path != NULL && strcmp(path, vd->vdev_path) == 0) 2306 return (vd); 2307 --- 73 unchanged lines hidden (view full) --- 2381 if (error && error != EEXIST) 2382 fatal(0, "spa_vdev_remove() = %d", error); 2383 } else { 2384 spa_config_exit(spa, SCL_VDEV, FTAG); 2385 2386 /* 2387 * Make 1/4 of the devices be log devices. 2388 */ | 2398static vdev_t * 2399vdev_lookup_by_path(vdev_t *vd, const char *path) 2400{ 2401 vdev_t *mvd; 2402 2403 if (vd->vdev_path != NULL && strcmp(path, vd->vdev_path) == 0) 2404 return (vd); 2405 --- 73 unchanged lines hidden (view full) --- 2479 if (error && error != EEXIST) 2480 fatal(0, "spa_vdev_remove() = %d", error); 2481 } else { 2482 spa_config_exit(spa, SCL_VDEV, FTAG); 2483 2484 /* 2485 * Make 1/4 of the devices be log devices. 2486 */ |
2389 nvroot = make_vdev_root(NULL, NULL, | 2487 nvroot = make_vdev_root(NULL, NULL, NULL, |
2390 ztest_opts.zo_vdev_size, 0, 2391 ztest_random(4) == 0, ztest_opts.zo_raidz, 2392 zs->zs_mirrors, 1); 2393 2394 error = spa_vdev_add(spa, nvroot); 2395 nvlist_free(nvroot); 2396 2397 if (error == ENOSPC) --- 60 unchanged lines hidden (view full) --- 2458 } 2459 2460 spa_config_exit(spa, SCL_VDEV, FTAG); 2461 2462 if (guid == 0) { 2463 /* 2464 * Add a new device. 2465 */ | 2488 ztest_opts.zo_vdev_size, 0, 2489 ztest_random(4) == 0, ztest_opts.zo_raidz, 2490 zs->zs_mirrors, 1); 2491 2492 error = spa_vdev_add(spa, nvroot); 2493 nvlist_free(nvroot); 2494 2495 if (error == ENOSPC) --- 60 unchanged lines hidden (view full) --- 2556 } 2557 2558 spa_config_exit(spa, SCL_VDEV, FTAG); 2559 2560 if (guid == 0) { 2561 /* 2562 * Add a new device. 2563 */ |
2466 nvlist_t *nvroot = make_vdev_root(NULL, aux, | 2564 nvlist_t *nvroot = make_vdev_root(NULL, aux, NULL, |
2467 (ztest_opts.zo_vdev_size * 5) / 4, 0, 0, 0, 0, 1); 2468 error = spa_vdev_add(spa, nvroot); 2469 if (error != 0) 2470 fatal(0, "spa_vdev_add(%p) = %d", nvroot, error); 2471 nvlist_free(nvroot); 2472 } else { 2473 /* 2474 * Remove an existing device. Sometimes, dirty its --- 252 unchanged lines hidden (view full) --- 2727 else 2728 expected_error = 0; 2729 2730 spa_config_exit(spa, SCL_VDEV, FTAG); 2731 2732 /* 2733 * Build the nvlist describing newpath. 2734 */ | 2565 (ztest_opts.zo_vdev_size * 5) / 4, 0, 0, 0, 0, 1); 2566 error = spa_vdev_add(spa, nvroot); 2567 if (error != 0) 2568 fatal(0, "spa_vdev_add(%p) = %d", nvroot, error); 2569 nvlist_free(nvroot); 2570 } else { 2571 /* 2572 * Remove an existing device. Sometimes, dirty its --- 252 unchanged lines hidden (view full) --- 2825 else 2826 expected_error = 0; 2827 2828 spa_config_exit(spa, SCL_VDEV, FTAG); 2829 2830 /* 2831 * Build the nvlist describing newpath. 2832 */ |
2735 root = make_vdev_root(newpath, NULL, newvd == NULL ? newsize : 0, | 2833 root = make_vdev_root(newpath, NULL, NULL, newvd == NULL ? newsize : 0, |
2736 ashift, 0, 0, 0, 1); 2737 2738 error = spa_vdev_attach(spa, oldguid, root, replacing); 2739 2740 nvlist_free(root); 2741 2742 /* 2743 * If our parent was the replacing vdev, but the replace completed, --- 2151 unchanged lines hidden (view full) --- 4895 4896 (void) rw_wrlock(&ztest_name_lock); 4897 error = spa_change_guid(spa); 4898 (void) rw_unlock(&ztest_name_lock); 4899 4900 if (error != 0) 4901 return; 4902 | 2834 ashift, 0, 0, 0, 1); 2835 2836 error = spa_vdev_attach(spa, oldguid, root, replacing); 2837 2838 nvlist_free(root); 2839 2840 /* 2841 * If our parent was the replacing vdev, but the replace completed, --- 2151 unchanged lines hidden (view full) --- 4993 4994 (void) rw_wrlock(&ztest_name_lock); 4995 error = spa_change_guid(spa); 4996 (void) rw_unlock(&ztest_name_lock); 4997 4998 if (error != 0) 4999 return; 5000 |
4903 if (ztest_opts.zo_verbose >= 3) { | 5001 if (ztest_opts.zo_verbose >= 4) { |
4904 (void) printf("Changed guid old %llu -> %llu\n", 4905 (u_longlong_t)orig, (u_longlong_t)spa_guid(spa)); 4906 } 4907 4908 VERIFY3U(orig, !=, spa_guid(spa)); 4909 VERIFY3U(load, ==, spa_load_guid(spa)); 4910} 4911 --- 730 unchanged lines hidden (view full) --- 5642 5643 /* 5644 * Create the storage pool. 5645 */ 5646 (void) spa_destroy(ztest_opts.zo_pool); 5647 ztest_shared->zs_vdev_next_leaf = 0; 5648 zs->zs_splits = 0; 5649 zs->zs_mirrors = ztest_opts.zo_mirrors; | 5002 (void) printf("Changed guid old %llu -> %llu\n", 5003 (u_longlong_t)orig, (u_longlong_t)spa_guid(spa)); 5004 } 5005 5006 VERIFY3U(orig, !=, spa_guid(spa)); 5007 VERIFY3U(load, ==, spa_load_guid(spa)); 5008} 5009 --- 730 unchanged lines hidden (view full) --- 5740 5741 /* 5742 * Create the storage pool. 5743 */ 5744 (void) spa_destroy(ztest_opts.zo_pool); 5745 ztest_shared->zs_vdev_next_leaf = 0; 5746 zs->zs_splits = 0; 5747 zs->zs_mirrors = ztest_opts.zo_mirrors; |
5650 nvroot = make_vdev_root(NULL, NULL, ztest_opts.zo_vdev_size, 0, | 5748 nvroot = make_vdev_root(NULL, NULL, NULL, ztest_opts.zo_vdev_size, 0, |
5651 0, ztest_opts.zo_raidz, zs->zs_mirrors, 1); 5652 props = make_random_props(); 5653 for (int i = 0; i < SPA_FEATURES; i++) { 5654 char buf[1024]; 5655 (void) snprintf(buf, sizeof (buf), "feature@%s", 5656 spa_feature_table[i].fi_uname); 5657 VERIFY3U(0, ==, nvlist_add_uint64(props, buf, 0)); 5658 } --- 416 unchanged lines hidden --- | 5749 0, ztest_opts.zo_raidz, zs->zs_mirrors, 1); 5750 props = make_random_props(); 5751 for (int i = 0; i < SPA_FEATURES; i++) { 5752 char buf[1024]; 5753 (void) snprintf(buf, sizeof (buf), "feature@%s", 5754 spa_feature_table[i].fi_uname); 5755 VERIFY3U(0, ==, nvlist_add_uint64(props, buf, 0)); 5756 } --- 416 unchanged lines hidden --- |