1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef O2CLUSTER_HEARTBEAT_H
28#define O2CLUSTER_HEARTBEAT_H
29
30#include "ocfs2_heartbeat.h"
31
32#define O2HB_REGION_TIMEOUT_MS 2000
33
34#define O2HB_MAX_REGION_NAME_LEN 32
35
36
37#define O2HB_LIVE_THRESHOLD 2
38
39extern unsigned int o2hb_dead_threshold;
40#define O2HB_DEFAULT_DEAD_THRESHOLD 31
41
42#define O2HB_MIN_DEAD_THRESHOLD 2
43#define O2HB_MAX_WRITE_TIMEOUT_MS (O2HB_REGION_TIMEOUT_MS * (o2hb_dead_threshold - 1))
44
45#define O2HB_CB_MAGIC 0x51d1e4ec
46
47
48enum o2hb_callback_type {
49 O2HB_NODE_DOWN_CB = 0,
50 O2HB_NODE_UP_CB,
51 O2HB_NUM_CB
52};
53
54struct o2nm_node;
55typedef void (o2hb_cb_func)(struct o2nm_node *, int, void *);
56
57struct o2hb_callback_func {
58 u32 hc_magic;
59 struct list_head hc_item;
60 o2hb_cb_func *hc_func;
61 void *hc_data;
62 int hc_priority;
63 enum o2hb_callback_type hc_type;
64};
65
66struct config_group *o2hb_alloc_hb_set(void);
67void o2hb_free_hb_set(struct config_group *group);
68
69void o2hb_setup_callback(struct o2hb_callback_func *hc,
70 enum o2hb_callback_type type,
71 o2hb_cb_func *func,
72 void *data,
73 int priority);
74int o2hb_register_callback(const char *region_uuid,
75 struct o2hb_callback_func *hc);
76void o2hb_unregister_callback(const char *region_uuid,
77 struct o2hb_callback_func *hc);
78void o2hb_fill_node_map(unsigned long *map,
79 unsigned bytes);
80void o2hb_exit(void);
81int o2hb_init(void);
82int o2hb_check_node_heartbeating_no_sem(u8 node_num);
83int o2hb_check_node_heartbeating_from_callback(u8 node_num);
84void o2hb_stop_all_regions(void);
85int o2hb_get_all_regions(char *region_uuids, u8 numregions);
86int o2hb_global_heartbeat_active(void);
87
88#endif
89