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
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/systm.h>
27 #include <sys/types.h>
28 #include <sys/vnode.h>
29 #include <sys/errno.h>
30 #include <sys/sysmacros.h>
31 #include <sys/debug.h>
32 #include <sys/kmem.h>
33 #include <sys/conf.h>
34 #include <sys/proc.h>
35 #include <sys/cmn_err.h>
36 #include <sys/fssnap_if.h>
37 #include <sys/fs/ufs_inode.h>
38 #include <sys/fs/ufs_filio.h>
39 #include <sys/fs/ufs_log.h>
40 #include <sys/fs/ufs_bio.h>
41 #include <sys/inttypes.h>
42 #include <sys/callb.h>
43 #include <sys/tnf_probe.h>
44
61 * Tunables
62 */
63 uint32_t lufs_num_roll_bufs = LUFS_DEFAULT_NUM_ROLL_BUFS;
64 uint32_t lufs_min_roll_bufs = LUFS_DEFAULT_MIN_ROLL_BUFS;
65 uint32_t lufs_max_roll_bufs = LUFS_DEFAULT_MAX_ROLL_BUFS;
66 long logmap_maxnme = 1536;
67 int trans_roll_tics = 0;
68 uint64_t trans_roll_new_delta = 0;
69 uint64_t lrr_wait = 0;
70 /*
71 * Key for thread specific data for the roll thread to
72 * bypass snapshot throttling
73 */
74 uint_t bypass_snapshot_throttle_key;
75
76 /*
77 * externs
78 */
79 extern kmutex_t ml_scan;
80 extern kcondvar_t ml_scan_cv;
81 extern int maxphys;
82
83 static void
84 trans_roll_wait(mt_map_t *logmap, callb_cpr_t *cprinfop)
85 {
86 mutex_enter(&logmap->mtm_mutex);
87 logmap->mtm_ref = 0;
88 if (logmap->mtm_flags & MTM_FORCE_ROLL) {
89 cv_broadcast(&logmap->mtm_from_roll_cv);
90 }
91 logmap->mtm_flags &= ~(MTM_FORCE_ROLL | MTM_ROLLING);
92 CALLB_CPR_SAFE_BEGIN(cprinfop);
93 (void) cv_reltimedwait(&logmap->mtm_to_roll_cv, &logmap->mtm_mutex,
94 trans_roll_tics, TR_CLOCK_TICK);
95 CALLB_CPR_SAFE_END(cprinfop, &logmap->mtm_mutex);
96 logmap->mtm_flags |= MTM_ROLLING;
97 mutex_exit(&logmap->mtm_mutex);
98 }
99
100 /*
101 * returns the number of 8K buffers to use for rolling the log
|
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
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25 /*
26 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
27 */
28
29 #include <sys/systm.h>
30 #include <sys/types.h>
31 #include <sys/vnode.h>
32 #include <sys/errno.h>
33 #include <sys/sysmacros.h>
34 #include <sys/debug.h>
35 #include <sys/kmem.h>
36 #include <sys/conf.h>
37 #include <sys/proc.h>
38 #include <sys/cmn_err.h>
39 #include <sys/fssnap_if.h>
40 #include <sys/fs/ufs_inode.h>
41 #include <sys/fs/ufs_filio.h>
42 #include <sys/fs/ufs_log.h>
43 #include <sys/fs/ufs_bio.h>
44 #include <sys/inttypes.h>
45 #include <sys/callb.h>
46 #include <sys/tnf_probe.h>
47
64 * Tunables
65 */
66 uint32_t lufs_num_roll_bufs = LUFS_DEFAULT_NUM_ROLL_BUFS;
67 uint32_t lufs_min_roll_bufs = LUFS_DEFAULT_MIN_ROLL_BUFS;
68 uint32_t lufs_max_roll_bufs = LUFS_DEFAULT_MAX_ROLL_BUFS;
69 long logmap_maxnme = 1536;
70 int trans_roll_tics = 0;
71 uint64_t trans_roll_new_delta = 0;
72 uint64_t lrr_wait = 0;
73 /*
74 * Key for thread specific data for the roll thread to
75 * bypass snapshot throttling
76 */
77 uint_t bypass_snapshot_throttle_key;
78
79 /*
80 * externs
81 */
82 extern kmutex_t ml_scan;
83 extern kcondvar_t ml_scan_cv;
84
85 static void
86 trans_roll_wait(mt_map_t *logmap, callb_cpr_t *cprinfop)
87 {
88 mutex_enter(&logmap->mtm_mutex);
89 logmap->mtm_ref = 0;
90 if (logmap->mtm_flags & MTM_FORCE_ROLL) {
91 cv_broadcast(&logmap->mtm_from_roll_cv);
92 }
93 logmap->mtm_flags &= ~(MTM_FORCE_ROLL | MTM_ROLLING);
94 CALLB_CPR_SAFE_BEGIN(cprinfop);
95 (void) cv_reltimedwait(&logmap->mtm_to_roll_cv, &logmap->mtm_mutex,
96 trans_roll_tics, TR_CLOCK_TICK);
97 CALLB_CPR_SAFE_END(cprinfop, &logmap->mtm_mutex);
98 logmap->mtm_flags |= MTM_ROLLING;
99 mutex_exit(&logmap->mtm_mutex);
100 }
101
102 /*
103 * returns the number of 8K buffers to use for rolling the log
|