Commit 8b0188b0 authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland

fs: dlm: add midcomms init/start functions

This patch introduces leftovers of init, start, stop and exit
functionality. The dlm application layer should always call the midcomms
layer which getting aware of such event and redirect it to the lowcomms
layer. Some functionality which is currently handled inside the start
functionality of midcomms and lowcomms should be handled in the init
functionality as it only need to be initialized once when dlm is loaded.
Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 17827754
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "recoverd.h" #include "recoverd.h"
#include "dir.h" #include "dir.h"
#include "midcomms.h" #include "midcomms.h"
#include "lowcomms.h"
#include "config.h" #include "config.h"
#include "memory.h" #include "memory.h"
#include "lock.h" #include "lock.h"
...@@ -723,7 +722,7 @@ static int __dlm_new_lockspace(const char *name, const char *cluster, ...@@ -723,7 +722,7 @@ static int __dlm_new_lockspace(const char *name, const char *cluster,
if (!ls_count) { if (!ls_count) {
dlm_scand_stop(); dlm_scand_stop();
dlm_midcomms_shutdown(); dlm_midcomms_shutdown();
dlm_lowcomms_stop(); dlm_midcomms_stop();
} }
out: out:
mutex_unlock(&ls_lock); mutex_unlock(&ls_lock);
...@@ -926,7 +925,7 @@ int dlm_release_lockspace(void *lockspace, int force) ...@@ -926,7 +925,7 @@ int dlm_release_lockspace(void *lockspace, int force)
if (!error) if (!error)
ls_count--; ls_count--;
if (!ls_count) if (!ls_count)
dlm_lowcomms_stop(); dlm_midcomms_stop();
mutex_unlock(&ls_lock); mutex_unlock(&ls_lock);
return error; return error;
......
...@@ -1987,10 +1987,6 @@ static const struct dlm_proto_ops dlm_sctp_ops = { ...@@ -1987,10 +1987,6 @@ static const struct dlm_proto_ops dlm_sctp_ops = {
int dlm_lowcomms_start(void) int dlm_lowcomms_start(void)
{ {
int error = -EINVAL; int error = -EINVAL;
int i;
for (i = 0; i < CONN_HASH_SIZE; i++)
INIT_HLIST_HEAD(&connection_hash[i]);
init_local(); init_local();
if (!dlm_local_count) { if (!dlm_local_count) {
...@@ -1999,8 +1995,6 @@ int dlm_lowcomms_start(void) ...@@ -1999,8 +1995,6 @@ int dlm_lowcomms_start(void)
goto fail; goto fail;
} }
INIT_WORK(&listen_con.rwork, process_listen_recv_socket);
error = work_start(); error = work_start();
if (error) if (error)
goto fail_local; goto fail_local;
...@@ -2039,6 +2033,16 @@ int dlm_lowcomms_start(void) ...@@ -2039,6 +2033,16 @@ int dlm_lowcomms_start(void)
return error; return error;
} }
void dlm_lowcomms_init(void)
{
int i;
for (i = 0; i < CONN_HASH_SIZE; i++)
INIT_HLIST_HEAD(&connection_hash[i]);
INIT_WORK(&listen_con.rwork, process_listen_recv_socket);
}
void dlm_lowcomms_exit(void) void dlm_lowcomms_exit(void)
{ {
struct dlm_node_addr *na, *safe; struct dlm_node_addr *na, *safe;
......
...@@ -35,6 +35,7 @@ extern int dlm_allow_conn; ...@@ -35,6 +35,7 @@ extern int dlm_allow_conn;
int dlm_lowcomms_start(void); int dlm_lowcomms_start(void);
void dlm_lowcomms_shutdown(void); void dlm_lowcomms_shutdown(void);
void dlm_lowcomms_stop(void); void dlm_lowcomms_stop(void);
void dlm_lowcomms_init(void);
void dlm_lowcomms_exit(void); void dlm_lowcomms_exit(void);
int dlm_lowcomms_close(int nodeid); int dlm_lowcomms_close(int nodeid);
struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation, struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation,
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "user.h" #include "user.h"
#include "memory.h" #include "memory.h"
#include "config.h" #include "config.h"
#include "lowcomms.h" #include "midcomms.h"
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/dlm.h> #include <trace/events/dlm.h>
...@@ -30,6 +30,8 @@ static int __init init_dlm(void) ...@@ -30,6 +30,8 @@ static int __init init_dlm(void)
if (error) if (error)
goto out; goto out;
dlm_midcomms_init();
error = dlm_lockspace_init(); error = dlm_lockspace_init();
if (error) if (error)
goto out_mem; goto out_mem;
...@@ -66,6 +68,7 @@ static int __init init_dlm(void) ...@@ -66,6 +68,7 @@ static int __init init_dlm(void)
out_lockspace: out_lockspace:
dlm_lockspace_exit(); dlm_lockspace_exit();
out_mem: out_mem:
dlm_midcomms_exit();
dlm_memory_exit(); dlm_memory_exit();
out: out:
return error; return error;
...@@ -79,7 +82,7 @@ static void __exit exit_dlm(void) ...@@ -79,7 +82,7 @@ static void __exit exit_dlm(void)
dlm_config_exit(); dlm_config_exit();
dlm_memory_exit(); dlm_memory_exit();
dlm_lockspace_exit(); dlm_lockspace_exit();
dlm_lowcomms_exit(); dlm_midcomms_exit();
dlm_unregister_debugfs(); dlm_unregister_debugfs();
} }
......
...@@ -1205,13 +1205,28 @@ void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh, ...@@ -1205,13 +1205,28 @@ void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh,
#endif #endif
int dlm_midcomms_start(void) int dlm_midcomms_start(void)
{
return dlm_lowcomms_start();
}
void dlm_midcomms_stop(void)
{
dlm_lowcomms_stop();
}
void dlm_midcomms_init(void)
{ {
int i; int i;
for (i = 0; i < CONN_HASH_SIZE; i++) for (i = 0; i < CONN_HASH_SIZE; i++)
INIT_HLIST_HEAD(&node_hash[i]); INIT_HLIST_HEAD(&node_hash[i]);
return dlm_lowcomms_start(); dlm_lowcomms_init();
}
void dlm_midcomms_exit(void)
{
dlm_lowcomms_exit();
} }
static void dlm_act_fin_ack_rcv(struct midcomms_node *node) static void dlm_act_fin_ack_rcv(struct midcomms_node *node)
......
...@@ -21,6 +21,9 @@ void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh, const void *name, ...@@ -21,6 +21,9 @@ void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh, const void *name,
int namelen); int namelen);
int dlm_midcomms_close(int nodeid); int dlm_midcomms_close(int nodeid);
int dlm_midcomms_start(void); int dlm_midcomms_start(void);
void dlm_midcomms_stop(void);
void dlm_midcomms_init(void);
void dlm_midcomms_exit(void);
void dlm_midcomms_shutdown(void); void dlm_midcomms_shutdown(void);
void dlm_midcomms_add_member(int nodeid); void dlm_midcomms_add_member(int nodeid);
void dlm_midcomms_remove_member(int nodeid); void dlm_midcomms_remove_member(int nodeid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment