]>
Commit | Line | Data |
---|---|---|
cae5b340 AX |
1 | /* |
2 | * CDDL HEADER START | |
3 | * | |
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 | |
7 | * 1.0 of the CDDL. | |
8 | * | |
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. | |
12 | * | |
13 | * CDDL HEADER END | |
14 | */ | |
15 | /* | |
16 | * Copyright (C) 2017 by Lawrence Livermore National Security, LLC. | |
17 | */ | |
18 | ||
19 | #ifndef _SYS_MMP_H | |
20 | #define _SYS_MMP_H | |
21 | ||
22 | #include <sys/spa.h> | |
23 | #include <sys/zfs_context.h> | |
24 | #include <sys/uberblock_impl.h> | |
25 | ||
26 | #ifdef __cplusplus | |
27 | extern "C" { | |
28 | #endif | |
29 | ||
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 | |
34 | ||
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 */ | |
42f7b73b AX |
45 | uint64_t mmp_kstat_id; /* unique id for next MMP write kstat */ |
46 | int mmp_skip_error; /* reason for last skipped write */ | |
cae5b340 AX |
47 | } mmp_thread_t; |
48 | ||
49 | ||
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); | |
56 | ||
57 | /* Global tuning */ | |
58 | extern ulong_t zfs_multihost_interval; | |
59 | extern uint_t zfs_multihost_fail_intervals; | |
60 | extern uint_t zfs_multihost_import_intervals; | |
61 | ||
62 | #ifdef __cplusplus | |
63 | } | |
64 | #endif | |
65 | ||
66 | #endif /* _SYS_MMP_H */ |