xref: /linux/fs/ocfs2/cluster/nodemanager.h (revision b5dd80304da482d77b2320e1a01a189e656b9770)
10c83ed8eSKurt Hackel /* -*- mode: c; c-basic-offset: 8; -*-
20c83ed8eSKurt Hackel  * vim: noexpandtab sw=8 ts=8 sts=0:
30c83ed8eSKurt Hackel  *
40c83ed8eSKurt Hackel  * nodemanager.h
50c83ed8eSKurt Hackel  *
60c83ed8eSKurt Hackel  * Function prototypes
70c83ed8eSKurt Hackel  *
80c83ed8eSKurt Hackel  * Copyright (C) 2004 Oracle.  All rights reserved.
90c83ed8eSKurt Hackel  *
100c83ed8eSKurt Hackel  * This program is free software; you can redistribute it and/or
110c83ed8eSKurt Hackel  * modify it under the terms of the GNU General Public
120c83ed8eSKurt Hackel  * License as published by the Free Software Foundation; either
130c83ed8eSKurt Hackel  * version 2 of the License, or (at your option) any later version.
140c83ed8eSKurt Hackel  *
150c83ed8eSKurt Hackel  * This program is distributed in the hope that it will be useful,
160c83ed8eSKurt Hackel  * but WITHOUT ANY WARRANTY; without even the implied warranty of
170c83ed8eSKurt Hackel  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
180c83ed8eSKurt Hackel  * General Public License for more details.
190c83ed8eSKurt Hackel  *
200c83ed8eSKurt Hackel  * You should have received a copy of the GNU General Public
210c83ed8eSKurt Hackel  * License along with this program; if not, write to the
220c83ed8eSKurt Hackel  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
230c83ed8eSKurt Hackel  * Boston, MA 021110-1307, USA.
240c83ed8eSKurt Hackel  *
250c83ed8eSKurt Hackel  */
260c83ed8eSKurt Hackel 
270c83ed8eSKurt Hackel #ifndef O2CLUSTER_NODEMANAGER_H
280c83ed8eSKurt Hackel #define O2CLUSTER_NODEMANAGER_H
290c83ed8eSKurt Hackel 
300c83ed8eSKurt Hackel #include "ocfs2_nodemanager.h"
310c83ed8eSKurt Hackel 
320c83ed8eSKurt Hackel /* This totally doesn't belong here. */
330c83ed8eSKurt Hackel #include <linux/configfs.h>
340c83ed8eSKurt Hackel #include <linux/rbtree.h>
350c83ed8eSKurt Hackel 
360c83ed8eSKurt Hackel #define KERN_OCFS2		988
370c83ed8eSKurt Hackel #define KERN_OCFS2_NM		1
380c83ed8eSKurt Hackel 
390c83ed8eSKurt Hackel const char *o2nm_get_hb_ctl_path(void);
400c83ed8eSKurt Hackel 
410c83ed8eSKurt Hackel struct o2nm_node {
420c83ed8eSKurt Hackel 	spinlock_t		nd_lock;
430c83ed8eSKurt Hackel 	struct config_item	nd_item;
440c83ed8eSKurt Hackel 	char			nd_name[O2NM_MAX_NAME_LEN+1]; /* replace? */
450c83ed8eSKurt Hackel 	__u8			nd_num;
460c83ed8eSKurt Hackel 	/* only one address per node, as attributes, for now. */
470c83ed8eSKurt Hackel 	__be32			nd_ipv4_address;
480c83ed8eSKurt Hackel 	__be16			nd_ipv4_port;
490c83ed8eSKurt Hackel 	struct rb_node		nd_ip_node;
500c83ed8eSKurt Hackel 	/* there can be only one local node for now */
510c83ed8eSKurt Hackel 	int			nd_local;
520c83ed8eSKurt Hackel 
530c83ed8eSKurt Hackel 	unsigned long		nd_set_attributes;
540c83ed8eSKurt Hackel };
550c83ed8eSKurt Hackel 
56296b75edSAndrew Beekhof struct o2nm_cluster {
57296b75edSAndrew Beekhof 	struct config_group	cl_group;
58296b75edSAndrew Beekhof 	unsigned		cl_has_local:1;
59296b75edSAndrew Beekhof 	u8			cl_local_node;
60296b75edSAndrew Beekhof 	rwlock_t		cl_nodes_lock;
61296b75edSAndrew Beekhof 	struct o2nm_node  	*cl_nodes[O2NM_MAX_NODES];
62296b75edSAndrew Beekhof 	struct rb_root		cl_node_ip_tree;
63*b5dd8030SJeff Mahoney 	unsigned int		cl_idle_timeout_ms;
64*b5dd8030SJeff Mahoney 	unsigned int		cl_keepalive_delay_ms;
65*b5dd8030SJeff Mahoney 	unsigned int		cl_reconnect_delay_ms;
66296b75edSAndrew Beekhof 
67296b75edSAndrew Beekhof 	/* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */
68296b75edSAndrew Beekhof 	unsigned long	cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)];
69296b75edSAndrew Beekhof };
70296b75edSAndrew Beekhof 
71296b75edSAndrew Beekhof extern struct o2nm_cluster *o2nm_single_cluster;
72296b75edSAndrew Beekhof 
730c83ed8eSKurt Hackel u8 o2nm_this_node(void);
740c83ed8eSKurt Hackel 
750c83ed8eSKurt Hackel int o2nm_configured_node_map(unsigned long *map, unsigned bytes);
760c83ed8eSKurt Hackel struct o2nm_node *o2nm_get_node_by_num(u8 node_num);
770c83ed8eSKurt Hackel struct o2nm_node *o2nm_get_node_by_ip(__be32 addr);
780c83ed8eSKurt Hackel void o2nm_node_get(struct o2nm_node *node);
790c83ed8eSKurt Hackel void o2nm_node_put(struct o2nm_node *node);
800c83ed8eSKurt Hackel 
810c83ed8eSKurt Hackel #endif /* O2CLUSTER_NODEMANAGER_H */
82