Print this page
2619 asynchronous destruction of ZFS file systems
2747 SPA versioning with zfs feature flags
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <gwilson@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>
Approved by: Dan McDonald <danmcd@nexenta.com>

*** 104,113 **** --- 104,114 ---- #include <sys/dsl_prop.h> #include <sys/dsl_dataset.h> #include <sys/dsl_scan.h> #include <sys/zio_checksum.h> #include <sys/refcount.h> + #include <sys/zfeature.h> #include <stdio.h> #include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <signal.h>
*** 5570,5583 **** static nvlist_t * make_random_props() { nvlist_t *props; - if (ztest_random(2) == 0) - return (NULL); - VERIFY(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) == 0); VERIFY(nvlist_add_uint64(props, "autoreplace", 1) == 0); return (props); } --- 5571,5583 ---- static nvlist_t * make_random_props() { nvlist_t *props; VERIFY(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) == 0); + if (ztest_random(2) == 0) + return (props); VERIFY(nvlist_add_uint64(props, "autoreplace", 1) == 0); return (props); }
*** 5604,5620 **** --- 5604,5627 ---- zs->zs_splits = 0; zs->zs_mirrors = ztest_opts.zo_mirrors; nvroot = make_vdev_root(NULL, NULL, ztest_opts.zo_vdev_size, 0, 0, ztest_opts.zo_raidz, zs->zs_mirrors, 1); props = make_random_props(); + for (int i = 0; i < SPA_FEATURES; i++) { + char buf[1024]; + (void) snprintf(buf, sizeof (buf), "feature@%s", + spa_feature_table[i].fi_uname); + VERIFY3U(0, ==, nvlist_add_uint64(props, buf, 0)); + } VERIFY3U(0, ==, spa_create(ztest_opts.zo_pool, nvroot, props, NULL, NULL)); nvlist_free(nvroot); VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG)); zs->zs_metaslab_sz = 1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift; + spa_close(spa, FTAG); kernel_fini(); ztest_run_zdb(ztest_opts.zo_pool);
*** 5640,5666 **** --- 5647,5693 ---- fd = open("/dev/urandom", O_RDONLY); ASSERT3U(fd, ==, ZTEST_FD_RAND); } + static int + shared_data_size(ztest_shared_hdr_t *hdr) + { + int size; + + size = hdr->zh_hdr_size; + size += hdr->zh_opts_size; + size += hdr->zh_size; + size += hdr->zh_stats_size * hdr->zh_stats_count; + size += hdr->zh_ds_size * hdr->zh_ds_count; + + return (size); + } + static void setup_hdr(void) { + int size; ztest_shared_hdr_t *hdr; hdr = (void *)mmap(0, P2ROUNDUP(sizeof (*hdr), getpagesize()), PROT_READ | PROT_WRITE, MAP_SHARED, ZTEST_FD_DATA, 0); ASSERT(hdr != MAP_FAILED); + VERIFY3U(0, ==, ftruncate(ZTEST_FD_DATA, sizeof (ztest_shared_hdr_t))); + hdr->zh_hdr_size = sizeof (ztest_shared_hdr_t); hdr->zh_opts_size = sizeof (ztest_shared_opts_t); hdr->zh_size = sizeof (ztest_shared_t); hdr->zh_stats_size = sizeof (ztest_shared_callstate_t); hdr->zh_stats_count = ZTEST_FUNCS; hdr->zh_ds_size = sizeof (ztest_shared_ds_t); hdr->zh_ds_count = ztest_opts.zo_datasets; + size = shared_data_size(hdr); + VERIFY3U(0, ==, ftruncate(ZTEST_FD_DATA, size)); + (void) munmap((caddr_t)hdr, P2ROUNDUP(sizeof (*hdr), getpagesize())); } static void setup_data(void)
*** 5671,5685 **** hdr = (void *)mmap(0, P2ROUNDUP(sizeof (*hdr), getpagesize()), PROT_READ, MAP_SHARED, ZTEST_FD_DATA, 0); ASSERT(hdr != MAP_FAILED); ! size = hdr->zh_hdr_size; ! size += hdr->zh_opts_size; ! size += hdr->zh_size; ! size += hdr->zh_stats_size * hdr->zh_stats_count; ! size += hdr->zh_ds_size * hdr->zh_ds_count; (void) munmap((caddr_t)hdr, P2ROUNDUP(sizeof (*hdr), getpagesize())); hdr = ztest_shared_hdr = (void *)mmap(0, P2ROUNDUP(size, getpagesize()), PROT_READ | PROT_WRITE, MAP_SHARED, ZTEST_FD_DATA, 0); ASSERT(hdr != MAP_FAILED); --- 5698,5708 ---- hdr = (void *)mmap(0, P2ROUNDUP(sizeof (*hdr), getpagesize()), PROT_READ, MAP_SHARED, ZTEST_FD_DATA, 0); ASSERT(hdr != MAP_FAILED); ! size = shared_data_size(hdr); (void) munmap((caddr_t)hdr, P2ROUNDUP(sizeof (*hdr), getpagesize())); hdr = ztest_shared_hdr = (void *)mmap(0, P2ROUNDUP(size, getpagesize()), PROT_READ | PROT_WRITE, MAP_SHARED, ZTEST_FD_DATA, 0); ASSERT(hdr != MAP_FAILED);