Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * nodemanager.h
0004  *
0005  * Function prototypes
0006  *
0007  * Copyright (C) 2004 Oracle.  All rights reserved.
0008  */
0009 
0010 #ifndef O2CLUSTER_NODEMANAGER_H
0011 #define O2CLUSTER_NODEMANAGER_H
0012 
0013 #include "ocfs2_nodemanager.h"
0014 
0015 /* This totally doesn't belong here. */
0016 #include <linux/configfs.h>
0017 #include <linux/rbtree.h>
0018 
0019 enum o2nm_fence_method {
0020     O2NM_FENCE_RESET    = 0,
0021     O2NM_FENCE_PANIC,
0022     O2NM_FENCE_METHODS, /* Number of fence methods */
0023 };
0024 
0025 struct o2nm_node {
0026     spinlock_t      nd_lock;
0027     struct config_item  nd_item;
0028     char            nd_name[O2NM_MAX_NAME_LEN+1]; /* replace? */
0029     __u8            nd_num;
0030     /* only one address per node, as attributes, for now. */
0031     __be32          nd_ipv4_address;
0032     __be16          nd_ipv4_port;
0033     struct rb_node      nd_ip_node;
0034     /* there can be only one local node for now */
0035     int         nd_local;
0036 
0037     unsigned long       nd_set_attributes;
0038 };
0039 
0040 struct o2nm_cluster {
0041     struct config_group cl_group;
0042     unsigned        cl_has_local:1;
0043     u8          cl_local_node;
0044     rwlock_t        cl_nodes_lock;
0045     struct o2nm_node    *cl_nodes[O2NM_MAX_NODES];
0046     struct rb_root      cl_node_ip_tree;
0047     unsigned int        cl_idle_timeout_ms;
0048     unsigned int        cl_keepalive_delay_ms;
0049     unsigned int        cl_reconnect_delay_ms;
0050     enum o2nm_fence_method  cl_fence_method;
0051 
0052     /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */
0053     unsigned long   cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)];
0054 };
0055 
0056 extern struct o2nm_cluster *o2nm_single_cluster;
0057 
0058 u8 o2nm_this_node(void);
0059 
0060 int o2nm_configured_node_map(unsigned long *map, unsigned bytes);
0061 struct o2nm_node *o2nm_get_node_by_num(u8 node_num);
0062 struct o2nm_node *o2nm_get_node_by_ip(__be32 addr);
0063 void o2nm_node_get(struct o2nm_node *node);
0064 void o2nm_node_put(struct o2nm_node *node);
0065 
0066 int o2nm_depend_item(struct config_item *item);
0067 void o2nm_undepend_item(struct config_item *item);
0068 int o2nm_depend_this_node(void);
0069 void o2nm_undepend_this_node(void);
0070 
0071 #endif /* O2CLUSTER_NODEMANAGER_H */