nodemanager.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * nodemanager.h
  4. *
  5. * Function prototypes
  6. *
  7. * Copyright (C) 2004 Oracle. All rights reserved.
  8. */
  9. #ifndef O2CLUSTER_NODEMANAGER_H
  10. #define O2CLUSTER_NODEMANAGER_H
  11. #include "ocfs2_nodemanager.h"
  12. /* This totally doesn't belong here. */
  13. #include <linux/configfs.h>
  14. #include <linux/rbtree.h>
  15. enum o2nm_fence_method {
  16. O2NM_FENCE_RESET = 0,
  17. O2NM_FENCE_PANIC,
  18. O2NM_FENCE_METHODS, /* Number of fence methods */
  19. };
  20. struct o2nm_node {
  21. spinlock_t nd_lock;
  22. struct config_item nd_item;
  23. char nd_name[O2NM_MAX_NAME_LEN+1]; /* replace? */
  24. __u8 nd_num;
  25. /* only one address per node, as attributes, for now. */
  26. __be32 nd_ipv4_address;
  27. __be16 nd_ipv4_port;
  28. struct rb_node nd_ip_node;
  29. /* there can be only one local node for now */
  30. int nd_local;
  31. unsigned long nd_set_attributes;
  32. };
  33. struct o2nm_cluster {
  34. struct config_group cl_group;
  35. unsigned cl_has_local:1;
  36. u8 cl_local_node;
  37. rwlock_t cl_nodes_lock;
  38. struct o2nm_node *cl_nodes[O2NM_MAX_NODES];
  39. struct rb_root cl_node_ip_tree;
  40. unsigned int cl_idle_timeout_ms;
  41. unsigned int cl_keepalive_delay_ms;
  42. unsigned int cl_reconnect_delay_ms;
  43. enum o2nm_fence_method cl_fence_method;
  44. /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */
  45. unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)];
  46. };
  47. extern struct o2nm_cluster *o2nm_single_cluster;
  48. u8 o2nm_this_node(void);
  49. int o2nm_configured_node_map(unsigned long *map, unsigned bytes);
  50. struct o2nm_node *o2nm_get_node_by_num(u8 node_num);
  51. struct o2nm_node *o2nm_get_node_by_ip(__be32 addr);
  52. void o2nm_node_get(struct o2nm_node *node);
  53. void o2nm_node_put(struct o2nm_node *node);
  54. int o2nm_depend_item(struct config_item *item);
  55. void o2nm_undepend_item(struct config_item *item);
  56. int o2nm_depend_this_node(void);
  57. void o2nm_undepend_this_node(void);
  58. #endif /* O2CLUSTER_NODEMANAGER_H */