spa_misc.c (258137) | spa_misc.c (258632) |
---|---|
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 --- 241 unchanged lines hidden (view full) --- 250 * set, calls to zfs_panic_recover() will turn into warning messages. 251 */ 252int zfs_recover = 0; 253SYSCTL_DECL(_vfs_zfs); 254TUNABLE_INT("vfs.zfs.recover", &zfs_recover); 255SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RDTUN, &zfs_recover, 0, 256 "Try to recover from otherwise-fatal errors."); 257 | 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 --- 241 unchanged lines hidden (view full) --- 250 * set, calls to zfs_panic_recover() will turn into warning messages. 251 */ 252int zfs_recover = 0; 253SYSCTL_DECL(_vfs_zfs); 254TUNABLE_INT("vfs.zfs.recover", &zfs_recover); 255SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RDTUN, &zfs_recover, 0, 256 "Try to recover from otherwise-fatal errors."); 257 |
258extern int zfs_txg_synctime_ms; | 258/* 259 * Expiration time in milliseconds. This value has two meanings. First it is 260 * used to determine when the spa_deadman() logic should fire. By default the 261 * spa_deadman() will fire if spa_sync() has not completed in 1000 seconds. 262 * Secondly, the value determines if an I/O is considered "hung". Any I/O that 263 * has not completed in zfs_deadman_synctime_ms is considered "hung" resulting 264 * in a system panic. 265 */ 266uint64_t zfs_deadman_synctime_ms = 1000000ULL; 267TUNABLE_QUAD("vfs.zfs.deadman_synctime_ms", &zfs_deadman_synctime_ms); 268SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime_ms, CTLFLAG_RDTUN, 269 &zfs_deadman_synctime_ms, 0, 270 "Stalled ZFS I/O expiration time in milliseconds"); |
259 260/* | 271 272/* |
261 * Expiration time in units of zfs_txg_synctime_ms. This value has two 262 * meanings. First it is used to determine when the spa_deadman logic 263 * should fire. By default the spa_deadman will fire if spa_sync has 264 * not completed in 1000 * zfs_txg_synctime_ms (i.e. 1000 seconds). 265 * Secondly, the value determines if an I/O is considered "hung". 266 * Any I/O that has not completed in zfs_deadman_synctime is considered 267 * "hung" resulting in a system panic. 268 * 1000 zfs_txg_synctime_ms (i.e. 1000 seconds). | 273 * Check time in milliseconds. This defines the frequency at which we check 274 * for hung I/O. |
269 */ | 275 */ |
270uint64_t zfs_deadman_synctime = 1000ULL; 271TUNABLE_QUAD("vfs.zfs.deadman_synctime", &zfs_deadman_synctime); 272SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime, CTLFLAG_RDTUN, 273 &zfs_deadman_synctime, 0, 274 "Stalled ZFS I/O expiration time in units of vfs.zfs.txg.synctime_ms"); | 276uint64_t zfs_deadman_checktime_ms = 5000ULL; 277TUNABLE_QUAD("vfs.zfs.deadman_checktime_ms", &zfs_deadman_checktime_ms); 278SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RDTUN, 279 &zfs_deadman_checktime_ms, 0, 280 "Period of checks for stalled ZFS I/O in milliseconds"); |
275 276/* 277 * Default value of -1 for zfs_deadman_enabled is resolved in 278 * zfs_deadman_init() 279 */ 280int zfs_deadman_enabled = -1; 281TUNABLE_INT("vfs.zfs.deadman_enabled", &zfs_deadman_enabled); 282SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RDTUN, 283 &zfs_deadman_enabled, 0, "Kernel panic on stalled ZFS I/O"); 284 | 281 282/* 283 * Default value of -1 for zfs_deadman_enabled is resolved in 284 * zfs_deadman_init() 285 */ 286int zfs_deadman_enabled = -1; 287TUNABLE_INT("vfs.zfs.deadman_enabled", &zfs_deadman_enabled); 288SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RDTUN, 289 &zfs_deadman_enabled, 0, "Kernel panic on stalled ZFS I/O"); 290 |
291/* 292 * The worst case is single-sector max-parity RAID-Z blocks, in which 293 * case the space requirement is exactly (VDEV_RAIDZ_MAXPARITY + 1) 294 * times the size; so just assume that. Add to this the fact that 295 * we can have up to 3 DVAs per bp, and one more factor of 2 because 296 * the block may be dittoed with up to 3 DVAs by ddt_sync(). All together, 297 * the worst case is: 298 * (VDEV_RAIDZ_MAXPARITY + 1) * SPA_DVAS_PER_BP * 2 == 24 299 */ 300int spa_asize_inflation = 24; 301 |
|
285#ifndef illumos 286#ifdef _KERNEL 287static void 288zfs_deadman_init() 289{ 290 /* 291 * If we are not i386 or amd64 or in a virtual machine, 292 * disable ZFS deadman thread by default --- 236 unchanged lines hidden (view full) --- 529 spa->spa_proc_state = SPA_PROC_NONE; 530 531#ifdef illumos 532 hdlr.cyh_func = spa_deadman; 533 hdlr.cyh_arg = spa; 534 hdlr.cyh_level = CY_LOW_LEVEL; 535#endif 536 | 302#ifndef illumos 303#ifdef _KERNEL 304static void 305zfs_deadman_init() 306{ 307 /* 308 * If we are not i386 or amd64 or in a virtual machine, 309 * disable ZFS deadman thread by default --- 236 unchanged lines hidden (view full) --- 546 spa->spa_proc_state = SPA_PROC_NONE; 547 548#ifdef illumos 549 hdlr.cyh_func = spa_deadman; 550 hdlr.cyh_arg = spa; 551 hdlr.cyh_level = CY_LOW_LEVEL; 552#endif 553 |
537 spa->spa_deadman_synctime = MSEC2NSEC(zfs_deadman_synctime * 538 zfs_txg_synctime_ms); | 554 spa->spa_deadman_synctime = MSEC2NSEC(zfs_deadman_synctime_ms); |
539 540#ifdef illumos 541 /* 542 * This determines how often we need to check for hung I/Os after 543 * the cyclic has already fired. Since checking for hung I/Os is 544 * an expensive operation we don't want to check too frequently. | 555 556#ifdef illumos 557 /* 558 * This determines how often we need to check for hung I/Os after 559 * the cyclic has already fired. Since checking for hung I/Os is 560 * an expensive operation we don't want to check too frequently. |
545 * Instead wait for 5 synctimes before checking again. | 561 * Instead wait for 5 seconds before checking again. |
546 */ | 562 */ |
547 when.cyt_interval = MSEC2NSEC(5 * zfs_txg_synctime_ms); | 563 when.cyt_interval = MSEC2NSEC(zfs_deadman_checktime_ms); |
548 when.cyt_when = CY_INFINITY; 549 mutex_enter(&cpu_lock); 550 spa->spa_deadman_cycid = cyclic_add(&hdlr, &when); 551 mutex_exit(&cpu_lock); 552#else /* !illumos */ 553#ifdef _KERNEL 554 callout_init(&spa->spa_deadman_cycid, CALLOUT_MPSAFE); 555#endif --- 973 unchanged lines hidden (view full) --- 1529{ 1530 return (spa->spa_freeze_txg); 1531} 1532 1533/* ARGSUSED */ 1534uint64_t 1535spa_get_asize(spa_t *spa, uint64_t lsize) 1536{ | 564 when.cyt_when = CY_INFINITY; 565 mutex_enter(&cpu_lock); 566 spa->spa_deadman_cycid = cyclic_add(&hdlr, &when); 567 mutex_exit(&cpu_lock); 568#else /* !illumos */ 569#ifdef _KERNEL 570 callout_init(&spa->spa_deadman_cycid, CALLOUT_MPSAFE); 571#endif --- 973 unchanged lines hidden (view full) --- 1545{ 1546 return (spa->spa_freeze_txg); 1547} 1548 1549/* ARGSUSED */ 1550uint64_t 1551spa_get_asize(spa_t *spa, uint64_t lsize) 1552{ |
1537 /* 1538 * The worst case is single-sector max-parity RAID-Z blocks, in which 1539 * case the space requirement is exactly (VDEV_RAIDZ_MAXPARITY + 1) 1540 * times the size; so just assume that. Add to this the fact that 1541 * we can have up to 3 DVAs per bp, and one more factor of 2 because 1542 * the block may be dittoed with up to 3 DVAs by ddt_sync(). 1543 */ 1544 return (lsize * (VDEV_RAIDZ_MAXPARITY + 1) * SPA_DVAS_PER_BP * 2); | 1553 return (lsize * spa_asize_inflation); |
1545} 1546 1547uint64_t 1548spa_get_dspace(spa_t *spa) 1549{ 1550 return (spa->spa_dspace); 1551} 1552 --- 343 unchanged lines hidden --- | 1554} 1555 1556uint64_t 1557spa_get_dspace(spa_t *spa) 1558{ 1559 return (spa->spa_dspace); 1560} 1561 --- 343 unchanged lines hidden --- |