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