^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* -*- mode: c; c-basic-offset: 8; -*-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * vim: noexpandtab sw=8 ts=8 sts=0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * nodemanager.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Function prototypes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Copyright (C) 2004 Oracle. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #ifndef O2CLUSTER_NODEMANAGER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define O2CLUSTER_NODEMANAGER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "ocfs2_nodemanager.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /* This totally doesn't belong here. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/configfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/rbtree.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) enum o2nm_fence_method {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) O2NM_FENCE_RESET = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) O2NM_FENCE_PANIC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) O2NM_FENCE_METHODS, /* Number of fence methods */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct o2nm_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) spinlock_t nd_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct config_item nd_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) char nd_name[O2NM_MAX_NAME_LEN+1]; /* replace? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) __u8 nd_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* only one address per node, as attributes, for now. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) __be32 nd_ipv4_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) __be16 nd_ipv4_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct rb_node nd_ip_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* there can be only one local node for now */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) int nd_local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) unsigned long nd_set_attributes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct o2nm_cluster {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct config_group cl_group;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) unsigned cl_has_local:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) u8 cl_local_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) rwlock_t cl_nodes_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct o2nm_node *cl_nodes[O2NM_MAX_NODES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct rb_root cl_node_ip_tree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) unsigned int cl_idle_timeout_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) unsigned int cl_keepalive_delay_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) unsigned int cl_reconnect_delay_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) enum o2nm_fence_method cl_fence_method;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) extern struct o2nm_cluster *o2nm_single_cluster;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) u8 o2nm_this_node(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int o2nm_configured_node_map(unsigned long *map, unsigned bytes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) struct o2nm_node *o2nm_get_node_by_num(u8 node_num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) struct o2nm_node *o2nm_get_node_by_ip(__be32 addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) void o2nm_node_get(struct o2nm_node *node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) void o2nm_node_put(struct o2nm_node *node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) int o2nm_depend_item(struct config_item *item);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) void o2nm_undepend_item(struct config_item *item);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) int o2nm_depend_this_node(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) void o2nm_undepend_this_node(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #endif /* O2CLUSTER_NODEMANAGER_H */