1328970deSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*fa60ce2cSMasahiro Yamada /* 30c83ed8eSKurt Hackel * nodemanager.h 40c83ed8eSKurt Hackel * 50c83ed8eSKurt Hackel * Function prototypes 60c83ed8eSKurt Hackel * 70c83ed8eSKurt Hackel * Copyright (C) 2004 Oracle. All rights reserved. 80c83ed8eSKurt Hackel */ 90c83ed8eSKurt Hackel 100c83ed8eSKurt Hackel #ifndef O2CLUSTER_NODEMANAGER_H 110c83ed8eSKurt Hackel #define O2CLUSTER_NODEMANAGER_H 120c83ed8eSKurt Hackel 130c83ed8eSKurt Hackel #include "ocfs2_nodemanager.h" 140c83ed8eSKurt Hackel 150c83ed8eSKurt Hackel /* This totally doesn't belong here. */ 160c83ed8eSKurt Hackel #include <linux/configfs.h> 170c83ed8eSKurt Hackel #include <linux/rbtree.h> 180c83ed8eSKurt Hackel 19f6656d26SSunil Mushran enum o2nm_fence_method { 20f6656d26SSunil Mushran O2NM_FENCE_RESET = 0, 21f6656d26SSunil Mushran O2NM_FENCE_PANIC, 22f6656d26SSunil Mushran O2NM_FENCE_METHODS, /* Number of fence methods */ 23f6656d26SSunil Mushran }; 24f6656d26SSunil Mushran 250c83ed8eSKurt Hackel struct o2nm_node { 260c83ed8eSKurt Hackel spinlock_t nd_lock; 270c83ed8eSKurt Hackel struct config_item nd_item; 280c83ed8eSKurt Hackel char nd_name[O2NM_MAX_NAME_LEN+1]; /* replace? */ 290c83ed8eSKurt Hackel __u8 nd_num; 300c83ed8eSKurt Hackel /* only one address per node, as attributes, for now. */ 310c83ed8eSKurt Hackel __be32 nd_ipv4_address; 320c83ed8eSKurt Hackel __be16 nd_ipv4_port; 330c83ed8eSKurt Hackel struct rb_node nd_ip_node; 340c83ed8eSKurt Hackel /* there can be only one local node for now */ 350c83ed8eSKurt Hackel int nd_local; 360c83ed8eSKurt Hackel 370c83ed8eSKurt Hackel unsigned long nd_set_attributes; 380c83ed8eSKurt Hackel }; 390c83ed8eSKurt Hackel 40296b75edSAndrew Beekhof struct o2nm_cluster { 41296b75edSAndrew Beekhof struct config_group cl_group; 42296b75edSAndrew Beekhof unsigned cl_has_local:1; 43296b75edSAndrew Beekhof u8 cl_local_node; 44296b75edSAndrew Beekhof rwlock_t cl_nodes_lock; 45296b75edSAndrew Beekhof struct o2nm_node *cl_nodes[O2NM_MAX_NODES]; 46296b75edSAndrew Beekhof struct rb_root cl_node_ip_tree; 47b5dd8030SJeff Mahoney unsigned int cl_idle_timeout_ms; 48b5dd8030SJeff Mahoney unsigned int cl_keepalive_delay_ms; 49b5dd8030SJeff Mahoney unsigned int cl_reconnect_delay_ms; 50f6656d26SSunil Mushran enum o2nm_fence_method cl_fence_method; 51296b75edSAndrew Beekhof 52296b75edSAndrew Beekhof /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */ 53296b75edSAndrew Beekhof unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; 54296b75edSAndrew Beekhof }; 55296b75edSAndrew Beekhof 56296b75edSAndrew Beekhof extern struct o2nm_cluster *o2nm_single_cluster; 57296b75edSAndrew Beekhof 580c83ed8eSKurt Hackel u8 o2nm_this_node(void); 590c83ed8eSKurt Hackel 600c83ed8eSKurt Hackel int o2nm_configured_node_map(unsigned long *map, unsigned bytes); 610c83ed8eSKurt Hackel struct o2nm_node *o2nm_get_node_by_num(u8 node_num); 620c83ed8eSKurt Hackel struct o2nm_node *o2nm_get_node_by_ip(__be32 addr); 630c83ed8eSKurt Hackel void o2nm_node_get(struct o2nm_node *node); 640c83ed8eSKurt Hackel void o2nm_node_put(struct o2nm_node *node); 650c83ed8eSKurt Hackel 6614829422SJoel Becker int o2nm_depend_item(struct config_item *item); 6714829422SJoel Becker void o2nm_undepend_item(struct config_item *item); 6816c6a4f2SJoel Becker int o2nm_depend_this_node(void); 6916c6a4f2SJoel Becker void o2nm_undepend_this_node(void); 7014829422SJoel Becker 710c83ed8eSKurt Hackel #endif /* O2CLUSTER_NODEMANAGER_H */ 72