From 5b2f981fde8b0dbf0bfa117bb4322342fcfb7174 Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Fri, 21 May 2021 15:08:47 -0400 Subject: fs: dlm: add midcomms debugfs functionality This patch adds functionality to debug midcomms per connection state inside a comms directory which is similar like dlm configfs. Currently there exists the possibility to read out two attributes which is the send queue counter and the version of each midcomms node state. Signed-off-by: Alexander Aring Signed-off-by: David Teigland --- fs/dlm/midcomms.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'fs/dlm/midcomms.c') diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c index eef3938a363e..35664950f6b7 100644 --- a/fs/dlm/midcomms.c +++ b/fs/dlm/midcomms.c @@ -189,6 +189,9 @@ struct midcomms_node { */ int users; + /* not protected by srcu, node_hash lifetime */ + void *debugfs; + struct hlist_node hlist; struct rcu_head rcu; }; @@ -244,6 +247,26 @@ static inline const char *dlm_state_str(int state) } } +const char *dlm_midcomms_state(struct midcomms_node *node) +{ + return dlm_state_str(node->state); +} + +unsigned long dlm_midcomms_flags(struct midcomms_node *node) +{ + return node->flags; +} + +int dlm_midcomms_send_queue_cnt(struct midcomms_node *node) +{ + return atomic_read(&node->send_queue_cnt); +} + +uint32_t dlm_midcomms_version(struct midcomms_node *node) +{ + return node->version; +} + static struct midcomms_node *__find_node(int nodeid, int r) { struct midcomms_node *node; @@ -332,6 +355,8 @@ static struct midcomms_node *nodeid2node(int nodeid, gfp_t alloc) hlist_add_head_rcu(&node->hlist, &node_hash[r]); spin_unlock(&nodes_lock); + + node->debugfs = dlm_create_debug_comms_file(nodeid, node); return node; } @@ -1285,6 +1310,8 @@ void dlm_midcomms_shutdown(void) hlist_for_each_entry_rcu(node, &node_hash[i], hlist) { midcomms_shutdown(node); + dlm_delete_debug_comms_file(node->debugfs); + spin_lock(&nodes_lock); hlist_del_rcu(&node->hlist); spin_unlock(&nodes_lock); -- cgit v1.2.3