Deleted Added
full compact
spa.c (251631) spa.c (251636)
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

--- 74 unchanged lines hidden (view full) ---

83/* Check hostid on import? */
84static int check_hostid = 1;
85
86SYSCTL_DECL(_vfs_zfs);
87TUNABLE_INT("vfs.zfs.check_hostid", &check_hostid);
88SYSCTL_INT(_vfs_zfs, OID_AUTO, check_hostid, CTLFLAG_RW, &check_hostid, 0,
89 "Check hostid on import?");
90
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

--- 74 unchanged lines hidden (view full) ---

83/* Check hostid on import? */
84static int check_hostid = 1;
85
86SYSCTL_DECL(_vfs_zfs);
87TUNABLE_INT("vfs.zfs.check_hostid", &check_hostid);
88SYSCTL_INT(_vfs_zfs, OID_AUTO, check_hostid, CTLFLAG_RW, &check_hostid, 0,
89 "Check hostid on import?");
90
91/*
92 * The interval, in seconds, at which failed configuration cache file writes
93 * should be retried.
94 */
95static int zfs_ccw_retry_interval = 300;
96
91typedef enum zti_modes {
92 zti_mode_fixed, /* value is # of threads (min 1) */
93 zti_mode_online_percent, /* value is % of online CPUs */
94 zti_mode_batch, /* cpu-intensive; value is ignored */
95 zti_mode_null, /* don't create a taskq */
96 zti_nmodes
97} zti_modes_t;
98

--- 5748 unchanged lines hidden (view full) ---

5847spa_async_resume(spa_t *spa)
5848{
5849 mutex_enter(&spa->spa_async_lock);
5850 ASSERT(spa->spa_async_suspended != 0);
5851 spa->spa_async_suspended--;
5852 mutex_exit(&spa->spa_async_lock);
5853}
5854
97typedef enum zti_modes {
98 zti_mode_fixed, /* value is # of threads (min 1) */
99 zti_mode_online_percent, /* value is % of online CPUs */
100 zti_mode_batch, /* cpu-intensive; value is ignored */
101 zti_mode_null, /* don't create a taskq */
102 zti_nmodes
103} zti_modes_t;
104

--- 5748 unchanged lines hidden (view full) ---

5853spa_async_resume(spa_t *spa)
5854{
5855 mutex_enter(&spa->spa_async_lock);
5856 ASSERT(spa->spa_async_suspended != 0);
5857 spa->spa_async_suspended--;
5858 mutex_exit(&spa->spa_async_lock);
5859}
5860
5861static boolean_t
5862spa_async_tasks_pending(spa_t *spa)
5863{
5864 uint_t non_config_tasks;
5865 uint_t config_task;
5866 boolean_t config_task_suspended;
5867
5868 non_config_tasks = spa->spa_async_tasks & ~SPA_ASYNC_CONFIG_UPDATE;
5869 config_task = spa->spa_async_tasks & SPA_ASYNC_CONFIG_UPDATE;
5870 if (spa->spa_ccw_fail_time == 0) {
5871 config_task_suspended = B_FALSE;
5872 } else {
5873 config_task_suspended =
5874 (gethrtime() - spa->spa_ccw_fail_time) <
5875 (zfs_ccw_retry_interval * NANOSEC);
5876 }
5877
5878 return (non_config_tasks || (config_task && !config_task_suspended));
5879}
5880
5855static void
5856spa_async_dispatch(spa_t *spa)
5857{
5858 mutex_enter(&spa->spa_async_lock);
5881static void
5882spa_async_dispatch(spa_t *spa)
5883{
5884 mutex_enter(&spa->spa_async_lock);
5859 if (spa->spa_async_tasks && !spa->spa_async_suspended &&
5885 if (spa_async_tasks_pending(spa) &&
5886 !spa->spa_async_suspended &&
5860 spa->spa_async_thread == NULL &&
5887 spa->spa_async_thread == NULL &&
5861 rootdir != NULL && !vn_is_readonly(rootdir))
5888 rootdir != NULL)
5862 spa->spa_async_thread = thread_create(NULL, 0,
5863 spa_async_thread, spa, 0, &p0, TS_RUN, maxclsyspri);
5864 mutex_exit(&spa->spa_async_lock);
5865}
5866
5867void
5868spa_async_request(spa_t *spa, int task)
5869{

--- 804 unchanged lines hidden ---
5889 spa->spa_async_thread = thread_create(NULL, 0,
5890 spa_async_thread, spa, 0, &p0, TS_RUN, maxclsyspri);
5891 mutex_exit(&spa->spa_async_lock);
5892}
5893
5894void
5895spa_async_request(spa_t *spa, int task)
5896{

--- 804 unchanged lines hidden ---