ztest.c (224177) | ztest.c (224526) |
---|---|
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 --- 191 unchanged lines hidden (view full) --- 200 char od_name[MAXNAMELEN]; 201} ztest_od_t; 202 203/* 204 * Per-dataset state. 205 */ 206typedef struct ztest_ds { 207 objset_t *zd_os; | 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 --- 191 unchanged lines hidden (view full) --- 200 char od_name[MAXNAMELEN]; 201} ztest_od_t; 202 203/* 204 * Per-dataset state. 205 */ 206typedef struct ztest_ds { 207 objset_t *zd_os; |
208 rwlock_t zd_zilog_lock; |
|
208 zilog_t *zd_zilog; 209 uint64_t zd_seq; 210 ztest_od_t *zd_od; /* debugging aid */ 211 char zd_name[MAXNAMELEN]; 212 mutex_t zd_dirobj_lock; 213 rll_t zd_object_lock[ZTEST_OBJECT_LOCKS]; 214 rll_t zd_range_lock[ZTEST_RANGE_LOCKS]; 215} ztest_ds_t; --- 17 unchanged lines hidden (view full) --- 233 */ 234ztest_func_t ztest_dmu_read_write; 235ztest_func_t ztest_dmu_write_parallel; 236ztest_func_t ztest_dmu_object_alloc_free; 237ztest_func_t ztest_dmu_commit_callbacks; 238ztest_func_t ztest_zap; 239ztest_func_t ztest_zap_parallel; 240ztest_func_t ztest_zil_commit; | 209 zilog_t *zd_zilog; 210 uint64_t zd_seq; 211 ztest_od_t *zd_od; /* debugging aid */ 212 char zd_name[MAXNAMELEN]; 213 mutex_t zd_dirobj_lock; 214 rll_t zd_object_lock[ZTEST_OBJECT_LOCKS]; 215 rll_t zd_range_lock[ZTEST_RANGE_LOCKS]; 216} ztest_ds_t; --- 17 unchanged lines hidden (view full) --- 234 */ 235ztest_func_t ztest_dmu_read_write; 236ztest_func_t ztest_dmu_write_parallel; 237ztest_func_t ztest_dmu_object_alloc_free; 238ztest_func_t ztest_dmu_commit_callbacks; 239ztest_func_t ztest_zap; 240ztest_func_t ztest_zap_parallel; 241ztest_func_t ztest_zil_commit; |
242ztest_func_t ztest_zil_remount; |
|
241ztest_func_t ztest_dmu_read_write_zcopy; 242ztest_func_t ztest_dmu_objset_create_destroy; 243ztest_func_t ztest_dmu_prealloc; 244ztest_func_t ztest_fzap; 245ztest_func_t ztest_dmu_snapshot_create_destroy; 246ztest_func_t ztest_dsl_prop_get_set; 247ztest_func_t ztest_spa_prop_get_set; 248ztest_func_t ztest_spa_create_destroy; --- 19 unchanged lines hidden (view full) --- 268 { ztest_dmu_read_write, 1, &zopt_always }, 269 { ztest_dmu_write_parallel, 10, &zopt_always }, 270 { ztest_dmu_object_alloc_free, 1, &zopt_always }, 271 { ztest_dmu_commit_callbacks, 1, &zopt_always }, 272 { ztest_zap, 30, &zopt_always }, 273 { ztest_zap_parallel, 100, &zopt_always }, 274 { ztest_split_pool, 1, &zopt_always }, 275 { ztest_zil_commit, 1, &zopt_incessant }, | 243ztest_func_t ztest_dmu_read_write_zcopy; 244ztest_func_t ztest_dmu_objset_create_destroy; 245ztest_func_t ztest_dmu_prealloc; 246ztest_func_t ztest_fzap; 247ztest_func_t ztest_dmu_snapshot_create_destroy; 248ztest_func_t ztest_dsl_prop_get_set; 249ztest_func_t ztest_spa_prop_get_set; 250ztest_func_t ztest_spa_create_destroy; --- 19 unchanged lines hidden (view full) --- 270 { ztest_dmu_read_write, 1, &zopt_always }, 271 { ztest_dmu_write_parallel, 10, &zopt_always }, 272 { ztest_dmu_object_alloc_free, 1, &zopt_always }, 273 { ztest_dmu_commit_callbacks, 1, &zopt_always }, 274 { ztest_zap, 30, &zopt_always }, 275 { ztest_zap_parallel, 100, &zopt_always }, 276 { ztest_split_pool, 1, &zopt_always }, 277 { ztest_zil_commit, 1, &zopt_incessant }, |
278 { ztest_zil_remount, 1, &zopt_sometimes }, |
|
276 { ztest_dmu_read_write_zcopy, 1, &zopt_often }, 277 { ztest_dmu_objset_create_destroy, 1, &zopt_often }, 278 { ztest_dsl_prop_get_set, 1, &zopt_often }, 279 { ztest_spa_prop_get_set, 1, &zopt_sometimes }, 280#if 0 281 { ztest_dmu_prealloc, 1, &zopt_sometimes }, 282#endif 283 { ztest_fzap, 1, &zopt_sometimes }, --- 697 unchanged lines hidden (view full) --- 981static void 982ztest_zd_init(ztest_ds_t *zd, objset_t *os) 983{ 984 zd->zd_os = os; 985 zd->zd_zilog = dmu_objset_zil(os); 986 zd->zd_seq = 0; 987 dmu_objset_name(os, zd->zd_name); 988 | 279 { ztest_dmu_read_write_zcopy, 1, &zopt_often }, 280 { ztest_dmu_objset_create_destroy, 1, &zopt_often }, 281 { ztest_dsl_prop_get_set, 1, &zopt_often }, 282 { ztest_spa_prop_get_set, 1, &zopt_sometimes }, 283#if 0 284 { ztest_dmu_prealloc, 1, &zopt_sometimes }, 285#endif 286 { ztest_fzap, 1, &zopt_sometimes }, --- 697 unchanged lines hidden (view full) --- 984static void 985ztest_zd_init(ztest_ds_t *zd, objset_t *os) 986{ 987 zd->zd_os = os; 988 zd->zd_zilog = dmu_objset_zil(os); 989 zd->zd_seq = 0; 990 dmu_objset_name(os, zd->zd_name); 991 |
992 VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0); |
|
989 VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); 990 991 for (int l = 0; l < ZTEST_OBJECT_LOCKS; l++) 992 ztest_rll_init(&zd->zd_object_lock[l]); 993 994 for (int l = 0; l < ZTEST_RANGE_LOCKS; l++) 995 ztest_rll_init(&zd->zd_range_lock[l]); 996} --- 963 unchanged lines hidden (view full) --- 1960 1961 /* 1962 * Pick an i/o type at random, biased toward writing block tags. 1963 */ 1964 io_type = ztest_random(ZTEST_IO_TYPES); 1965 if (ztest_random(2) == 0) 1966 io_type = ZTEST_IO_WRITE_TAG; 1967 | 993 VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); 994 995 for (int l = 0; l < ZTEST_OBJECT_LOCKS; l++) 996 ztest_rll_init(&zd->zd_object_lock[l]); 997 998 for (int l = 0; l < ZTEST_RANGE_LOCKS; l++) 999 ztest_rll_init(&zd->zd_range_lock[l]); 1000} --- 963 unchanged lines hidden (view full) --- 1964 1965 /* 1966 * Pick an i/o type at random, biased toward writing block tags. 1967 */ 1968 io_type = ztest_random(ZTEST_IO_TYPES); 1969 if (ztest_random(2) == 0) 1970 io_type = ZTEST_IO_WRITE_TAG; 1971 |
1972 (void) rw_rdlock(&zd->zd_zilog_lock); 1973 |
|
1968 switch (io_type) { 1969 1970 case ZTEST_IO_WRITE_TAG: 1971 ztest_bt_generate(&wbt, zd->zd_os, object, offset, 0, 0, 0); 1972 (void) ztest_write(zd, object, offset, sizeof (wbt), &wbt); 1973 break; 1974 1975 case ZTEST_IO_WRITE_PATTERN: --- 19 unchanged lines hidden (view full) --- 1995 (void) ztest_truncate(zd, object, offset, blocksize); 1996 break; 1997 1998 case ZTEST_IO_SETATTR: 1999 (void) ztest_setattr(zd, object); 2000 break; 2001 } 2002 | 1974 switch (io_type) { 1975 1976 case ZTEST_IO_WRITE_TAG: 1977 ztest_bt_generate(&wbt, zd->zd_os, object, offset, 0, 0, 0); 1978 (void) ztest_write(zd, object, offset, sizeof (wbt), &wbt); 1979 break; 1980 1981 case ZTEST_IO_WRITE_PATTERN: --- 19 unchanged lines hidden (view full) --- 2001 (void) ztest_truncate(zd, object, offset, blocksize); 2002 break; 2003 2004 case ZTEST_IO_SETATTR: 2005 (void) ztest_setattr(zd, object); 2006 break; 2007 } 2008 |
2009 (void) rw_unlock(&zd->zd_zilog_lock); 2010 |
|
2003 umem_free(data, blocksize); 2004} 2005 2006/* 2007 * Initialize an object description template. 2008 */ 2009static void 2010ztest_od_init(ztest_od_t *od, uint64_t id, char *tag, uint64_t index, --- 38 unchanged lines hidden (view full) --- 2049} 2050 2051/* ARGSUSED */ 2052void 2053ztest_zil_commit(ztest_ds_t *zd, uint64_t id) 2054{ 2055 zilog_t *zilog = zd->zd_zilog; 2056 | 2011 umem_free(data, blocksize); 2012} 2013 2014/* 2015 * Initialize an object description template. 2016 */ 2017static void 2018ztest_od_init(ztest_od_t *od, uint64_t id, char *tag, uint64_t index, --- 38 unchanged lines hidden (view full) --- 2057} 2058 2059/* ARGSUSED */ 2060void 2061ztest_zil_commit(ztest_ds_t *zd, uint64_t id) 2062{ 2063 zilog_t *zilog = zd->zd_zilog; 2064 |
2065 (void) rw_rdlock(&zd->zd_zilog_lock); 2066 |
|
2057 zil_commit(zilog, ztest_random(ZTEST_OBJECTS)); 2058 2059 /* 2060 * Remember the committed values in zd, which is in parent/child 2061 * shared memory. If we die, the next iteration of ztest_run() 2062 * will verify that the log really does contain this record. 2063 */ 2064 mutex_enter(&zilog->zl_lock); 2065 ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq); 2066 zd->zd_seq = zilog->zl_commit_lr_seq; 2067 mutex_exit(&zilog->zl_lock); | 2067 zil_commit(zilog, ztest_random(ZTEST_OBJECTS)); 2068 2069 /* 2070 * Remember the committed values in zd, which is in parent/child 2071 * shared memory. If we die, the next iteration of ztest_run() 2072 * will verify that the log really does contain this record. 2073 */ 2074 mutex_enter(&zilog->zl_lock); 2075 ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq); 2076 zd->zd_seq = zilog->zl_commit_lr_seq; 2077 mutex_exit(&zilog->zl_lock); |
2078 2079 (void) rw_unlock(&zd->zd_zilog_lock); |
|
2068} 2069 2070/* | 2080} 2081 2082/* |
2083 * This function is designed to simulate the operations that occur during a 2084 * mount/unmount operation. We hold the dataset across these operations in an 2085 * attempt to expose any implicit assumptions about ZIL management. 2086 */ 2087/* ARGSUSED */ 2088void 2089ztest_zil_remount(ztest_ds_t *zd, uint64_t id) 2090{ 2091 objset_t *os = zd->zd_os; 2092 2093 (void) rw_wrlock(&zd->zd_zilog_lock); 2094 2095 /* zfsvfs_teardown() */ 2096 zil_close(zd->zd_zilog); 2097 2098 /* zfsvfs_setup() */ 2099 VERIFY(zil_open(os, ztest_get_data) == zd->zd_zilog); 2100 zil_replay(os, zd, ztest_replay_vector); 2101 2102 (void) rw_unlock(&zd->zd_zilog_lock); 2103} 2104 2105/* |
|
2071 * Verify that we can't destroy an active pool, create an existing pool, 2072 * or create a pool with a bad vdev spec. 2073 */ 2074/* ARGSUSED */ 2075void 2076ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) 2077{ 2078 ztest_shared_t *zs = ztest_shared; --- 3534 unchanged lines hidden --- | 2106 * Verify that we can't destroy an active pool, create an existing pool, 2107 * or create a pool with a bad vdev spec. 2108 */ 2109/* ARGSUSED */ 2110void 2111ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) 2112{ 2113 ztest_shared_t *zs = ztest_shared; --- 3534 unchanged lines hidden --- |