4 * This file and its contents are supplied under the terms of the
5 * Common Development and Distribution License ("CDDL"), version 1.0.
6 * You may only use this file in accordance with the terms of version
9 * A full copy of the text of the CDDL should have accompanied this
10 * source. A copy of the CDDL is also available via the Internet at
11 * http://www.illumos.org/license/CDDL.
16 * Copyright (C) 2017 by Lawrence Livermore National Security, LLC.
23 #include <sys/zfs_context.h>
24 #include <sys/uberblock_impl.h>
30 #define MMP_MIN_INTERVAL 100 /* ms */
31 #define MMP_DEFAULT_INTERVAL 1000 /* ms */
32 #define MMP_DEFAULT_IMPORT_INTERVALS 10
33 #define MMP_DEFAULT_FAIL_INTERVALS 5
35 typedef struct mmp_thread
{
36 kmutex_t mmp_thread_lock
; /* protect thread mgmt fields */
37 kcondvar_t mmp_thread_cv
;
38 kthread_t
*mmp_thread
;
39 uint8_t mmp_thread_exiting
;
40 kmutex_t mmp_io_lock
; /* protect below */
41 hrtime_t mmp_last_write
; /* last successful MMP write */
42 uint64_t mmp_delay
; /* decaying avg ns between MMP writes */
43 uberblock_t mmp_ub
; /* last ub written by sync */
44 zio_t
*mmp_zio_root
; /* root of mmp write zios */
45 uint64_t mmp_kstat_id
; /* unique id for next MMP write kstat */
46 int mmp_skip_error
; /* reason for last skipped write */
50 extern void mmp_init(struct spa
*spa
);
51 extern void mmp_fini(struct spa
*spa
);
52 extern void mmp_thread_start(struct spa
*spa
);
53 extern void mmp_thread_stop(struct spa
*spa
);
54 extern void mmp_update_uberblock(struct spa
*spa
, struct uberblock
*ub
);
55 extern void mmp_signal_all_threads(void);
58 extern ulong_t zfs_multihost_interval
;
59 extern uint_t zfs_multihost_fail_intervals
;
60 extern uint_t zfs_multihost_import_intervals
;
66 #endif /* _SYS_MMP_H */