0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef O2CLUSTER_HEARTBEAT_H
0011 #define O2CLUSTER_HEARTBEAT_H
0012
0013 #include "ocfs2_heartbeat.h"
0014
0015 #define O2HB_REGION_TIMEOUT_MS 2000
0016
0017 #define O2HB_MAX_REGION_NAME_LEN 32
0018
0019
0020 #define O2HB_LIVE_THRESHOLD 2
0021
0022 extern unsigned int o2hb_dead_threshold;
0023 #define O2HB_DEFAULT_DEAD_THRESHOLD 31
0024
0025 #define O2HB_MIN_DEAD_THRESHOLD 2
0026 #define O2HB_MAX_WRITE_TIMEOUT_MS (O2HB_REGION_TIMEOUT_MS * (o2hb_dead_threshold - 1))
0027
0028 #define O2HB_CB_MAGIC 0x51d1e4ec
0029
0030
0031 enum o2hb_callback_type {
0032 O2HB_NODE_DOWN_CB = 0,
0033 O2HB_NODE_UP_CB,
0034 O2HB_NUM_CB
0035 };
0036
0037 struct o2nm_node;
0038 typedef void (o2hb_cb_func)(struct o2nm_node *, int, void *);
0039
0040 struct o2hb_callback_func {
0041 u32 hc_magic;
0042 struct list_head hc_item;
0043 o2hb_cb_func *hc_func;
0044 void *hc_data;
0045 int hc_priority;
0046 enum o2hb_callback_type hc_type;
0047 };
0048
0049 struct config_group *o2hb_alloc_hb_set(void);
0050 void o2hb_free_hb_set(struct config_group *group);
0051
0052 void o2hb_setup_callback(struct o2hb_callback_func *hc,
0053 enum o2hb_callback_type type,
0054 o2hb_cb_func *func,
0055 void *data,
0056 int priority);
0057 int o2hb_register_callback(const char *region_uuid,
0058 struct o2hb_callback_func *hc);
0059 void o2hb_unregister_callback(const char *region_uuid,
0060 struct o2hb_callback_func *hc);
0061 void o2hb_fill_node_map(unsigned long *map,
0062 unsigned bytes);
0063 void o2hb_exit(void);
0064 void o2hb_init(void);
0065 int o2hb_check_node_heartbeating_no_sem(u8 node_num);
0066 int o2hb_check_node_heartbeating_from_callback(u8 node_num);
0067 void o2hb_stop_all_regions(void);
0068 int o2hb_get_all_regions(char *region_uuids, u8 numregions);
0069 int o2hb_global_heartbeat_active(void);
0070
0071 #endif