diff options
author | Sunil Mushran <sunil.mushran@oracle.com> | 2011-07-24 13:32:54 -0400 |
---|---|---|
committer | Sunil Mushran <sunil.mushran@oracle.com> | 2011-07-24 13:32:54 -0400 |
commit | 3ba169ccec1c5ad0f678e04fd29b990197fdfe79 (patch) | |
tree | 44aa0576afaf198a717e12b0450f45619e2c5cc4 /fs/ocfs2/cluster/tcp.c | |
parent | bb570a5d9e74f71d32751823052db4a97d6a5e7c (diff) |
ocfs2/cluster: Add new function o2net_fill_node_map()
Patch adds function o2net_fill_node_map() to return the bitmap of nodes that
it is connected to. This bitmap is also accessible by the user via the debugfs
file, /sys/kernel/debug/o2net/connected_nodes.
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Diffstat (limited to 'fs/ocfs2/cluster/tcp.c')
-rw-r--r-- | fs/ocfs2/cluster/tcp.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 6e97895ecf24..ae13d5ca7908 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -1034,6 +1034,25 @@ static int o2net_tx_can_proceed(struct o2net_node *nn, | |||
1034 | return ret; | 1034 | return ret; |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | /* Get a map of all nodes to which this node is currently connected to */ | ||
1038 | void o2net_fill_node_map(unsigned long *map, unsigned bytes) | ||
1039 | { | ||
1040 | struct o2net_sock_container *sc; | ||
1041 | int node, ret; | ||
1042 | |||
1043 | BUG_ON(bytes < (BITS_TO_LONGS(O2NM_MAX_NODES) * sizeof(unsigned long))); | ||
1044 | |||
1045 | memset(map, 0, bytes); | ||
1046 | for (node = 0; node < O2NM_MAX_NODES; ++node) { | ||
1047 | o2net_tx_can_proceed(o2net_nn_from_num(node), &sc, &ret); | ||
1048 | if (!ret) { | ||
1049 | set_bit(node, map); | ||
1050 | sc_put(sc); | ||
1051 | } | ||
1052 | } | ||
1053 | } | ||
1054 | EXPORT_SYMBOL_GPL(o2net_fill_node_map); | ||
1055 | |||
1037 | int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec, | 1056 | int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec, |
1038 | size_t caller_veclen, u8 target_node, int *status) | 1057 | size_t caller_veclen, u8 target_node, int *status) |
1039 | { | 1058 | { |