1 /* SPDX-License-Identifier: GPL-2.0-or-later */
7 * Copyright (C) 2004 Oracle. All rights reserved.
10 #ifndef O2CLUSTER_HEARTBEAT_H
11 #define O2CLUSTER_HEARTBEAT_H
13 #include "ocfs2_heartbeat.h"
15 #define O2HB_REGION_TIMEOUT_MS 2000
17 #define O2HB_MAX_REGION_NAME_LEN 32
19 /* number of changes to be seen as live */
20 #define O2HB_LIVE_THRESHOLD 2
21 /* number of equal samples to be seen as dead */
22 extern unsigned int o2hb_dead_threshold;
23 #define O2HB_DEFAULT_DEAD_THRESHOLD 31
24 /* Otherwise MAX_WRITE_TIMEOUT will be zero... */
25 #define O2HB_MIN_DEAD_THRESHOLD 2
26 #define O2HB_MAX_WRITE_TIMEOUT_MS (O2HB_REGION_TIMEOUT_MS * (o2hb_dead_threshold - 1))
28 #define O2HB_CB_MAGIC 0x51d1e4ec
31 enum o2hb_callback_type {
32 O2HB_NODE_DOWN_CB = 0,
38 typedef void (o2hb_cb_func)(struct o2nm_node *, int, void *);
40 struct o2hb_callback_func {
42 struct list_head hc_item;
43 o2hb_cb_func *hc_func;
46 enum o2hb_callback_type hc_type;
49 struct config_group *o2hb_alloc_hb_set(void);
50 void o2hb_free_hb_set(struct config_group *group);
52 void o2hb_setup_callback(struct o2hb_callback_func *hc,
53 enum o2hb_callback_type type,
57 int o2hb_register_callback(const char *region_uuid,
58 struct o2hb_callback_func *hc);
59 void o2hb_unregister_callback(const char *region_uuid,
60 struct o2hb_callback_func *hc);
61 void o2hb_fill_node_map(unsigned long *map,
65 int o2hb_check_node_heartbeating_no_sem(u8 node_num);
66 int o2hb_check_node_heartbeating_from_callback(u8 node_num);
67 void o2hb_stop_all_regions(void);
68 int o2hb_get_all_regions(char *region_uuids, u8 numregions);
69 int o2hb_global_heartbeat_active(void);
71 #endif /* O2CLUSTER_HEARTBEAT_H */