2019-05-24 17:04:05 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2005-12-16 05:31:23 +07:00
|
|
|
/* -*- mode: c; c-basic-offset: 8; -*-
|
|
|
|
* vim: noexpandtab sw=8 ts=8 sts=0:
|
|
|
|
*
|
|
|
|
* nodemanager.h
|
|
|
|
*
|
|
|
|
* Function prototypes
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Oracle. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef O2CLUSTER_NODEMANAGER_H
|
|
|
|
#define O2CLUSTER_NODEMANAGER_H
|
|
|
|
|
|
|
|
#include "ocfs2_nodemanager.h"
|
|
|
|
|
|
|
|
/* This totally doesn't belong here. */
|
|
|
|
#include <linux/configfs.h>
|
|
|
|
#include <linux/rbtree.h>
|
|
|
|
|
2009-11-18 07:29:19 +07:00
|
|
|
enum o2nm_fence_method {
|
|
|
|
O2NM_FENCE_RESET = 0,
|
|
|
|
O2NM_FENCE_PANIC,
|
|
|
|
O2NM_FENCE_METHODS, /* Number of fence methods */
|
|
|
|
};
|
|
|
|
|
2005-12-16 05:31:23 +07:00
|
|
|
struct o2nm_node {
|
|
|
|
spinlock_t nd_lock;
|
|
|
|
struct config_item nd_item;
|
|
|
|
char nd_name[O2NM_MAX_NAME_LEN+1]; /* replace? */
|
|
|
|
__u8 nd_num;
|
|
|
|
/* only one address per node, as attributes, for now. */
|
|
|
|
__be32 nd_ipv4_address;
|
|
|
|
__be16 nd_ipv4_port;
|
|
|
|
struct rb_node nd_ip_node;
|
|
|
|
/* there can be only one local node for now */
|
|
|
|
int nd_local;
|
|
|
|
|
|
|
|
unsigned long nd_set_attributes;
|
|
|
|
};
|
|
|
|
|
2006-12-04 20:04:53 +07:00
|
|
|
struct o2nm_cluster {
|
|
|
|
struct config_group cl_group;
|
|
|
|
unsigned cl_has_local:1;
|
|
|
|
u8 cl_local_node;
|
|
|
|
rwlock_t cl_nodes_lock;
|
|
|
|
struct o2nm_node *cl_nodes[O2NM_MAX_NODES];
|
|
|
|
struct rb_root cl_node_ip_tree;
|
2006-12-04 20:04:54 +07:00
|
|
|
unsigned int cl_idle_timeout_ms;
|
|
|
|
unsigned int cl_keepalive_delay_ms;
|
|
|
|
unsigned int cl_reconnect_delay_ms;
|
2009-11-18 07:29:19 +07:00
|
|
|
enum o2nm_fence_method cl_fence_method;
|
2006-12-04 20:04:53 +07:00
|
|
|
|
|
|
|
/* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */
|
|
|
|
unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)];
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct o2nm_cluster *o2nm_single_cluster;
|
|
|
|
|
2005-12-16 05:31:23 +07:00
|
|
|
u8 o2nm_this_node(void);
|
|
|
|
|
|
|
|
int o2nm_configured_node_map(unsigned long *map, unsigned bytes);
|
|
|
|
struct o2nm_node *o2nm_get_node_by_num(u8 node_num);
|
|
|
|
struct o2nm_node *o2nm_get_node_by_ip(__be32 addr);
|
|
|
|
void o2nm_node_get(struct o2nm_node *node);
|
|
|
|
void o2nm_node_put(struct o2nm_node *node);
|
|
|
|
|
2007-06-15 11:40:49 +07:00
|
|
|
int o2nm_depend_item(struct config_item *item);
|
|
|
|
void o2nm_undepend_item(struct config_item *item);
|
2007-06-20 01:34:03 +07:00
|
|
|
int o2nm_depend_this_node(void);
|
|
|
|
void o2nm_undepend_this_node(void);
|
2007-06-15 11:40:49 +07:00
|
|
|
|
2005-12-16 05:31:23 +07:00
|
|
|
#endif /* O2CLUSTER_NODEMANAGER_H */
|