diff options
author | Goldwyn Rodrigues <rgoldwyn@suse.de> | 2014-01-21 18:48:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-21 19:19:41 -0500 |
commit | 3e8341516409d026636be4d7534b84e6e90bef37 (patch) | |
tree | ab6d15e41377cf38b709683890e493a3223d2303 | |
parent | 24aa338611e9b02d045a1a99050135b0d49f41b5 (diff) |
ocfs2: pass ocfs2_cluster_connection to ocfs2_this_node
This is done to differentiate between using and not using controld and
use the connection information accordingly.
We need to be backward compatible. So, we use a new enum
ocfs2_connection_type to identify when controld is used and when it is
not.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ocfs2/dlmglue.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/stack_o2cb.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/stack_user.c | 16 | ||||
-rw-r--r-- | fs/ocfs2/stackglue.c | 5 | ||||
-rw-r--r-- | fs/ocfs2/stackglue.h | 6 |
5 files changed, 24 insertions, 8 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 85852d62aa52..19986959d149 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -3007,7 +3007,7 @@ int ocfs2_dlm_init(struct ocfs2_super *osb) | |||
3007 | goto bail; | 3007 | goto bail; |
3008 | } | 3008 | } |
3009 | 3009 | ||
3010 | status = ocfs2_cluster_this_node(&osb->node_num); | 3010 | status = ocfs2_cluster_this_node(conn, &osb->node_num); |
3011 | if (status < 0) { | 3011 | if (status < 0) { |
3012 | mlog_errno(status); | 3012 | mlog_errno(status); |
3013 | mlog(ML_ERROR, | 3013 | mlog(ML_ERROR, |
diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c index bf1f8930456f..1724d43d3da1 100644 --- a/fs/ocfs2/stack_o2cb.c +++ b/fs/ocfs2/stack_o2cb.c | |||
@@ -398,7 +398,8 @@ static int o2cb_cluster_disconnect(struct ocfs2_cluster_connection *conn) | |||
398 | return 0; | 398 | return 0; |
399 | } | 399 | } |
400 | 400 | ||
401 | static int o2cb_cluster_this_node(unsigned int *node) | 401 | static int o2cb_cluster_this_node(struct ocfs2_cluster_connection *conn, |
402 | unsigned int *node) | ||
402 | { | 403 | { |
403 | int node_num; | 404 | int node_num; |
404 | 405 | ||
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index 0afb86d9b279..22b95acc2a82 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c | |||
@@ -103,6 +103,11 @@ | |||
103 | #define OCFS2_CONTROL_MESSAGE_VERNUM_LEN 2 | 103 | #define OCFS2_CONTROL_MESSAGE_VERNUM_LEN 2 |
104 | #define OCFS2_CONTROL_MESSAGE_NODENUM_LEN 8 | 104 | #define OCFS2_CONTROL_MESSAGE_NODENUM_LEN 8 |
105 | 105 | ||
106 | enum ocfs2_connection_type { | ||
107 | WITH_CONTROLD, | ||
108 | NO_CONTROLD | ||
109 | }; | ||
110 | |||
106 | /* | 111 | /* |
107 | * ocfs2_live_connection is refcounted because the filesystem and | 112 | * ocfs2_live_connection is refcounted because the filesystem and |
108 | * miscdevice sides can detach in different order. Let's just be safe. | 113 | * miscdevice sides can detach in different order. Let's just be safe. |
@@ -110,6 +115,7 @@ | |||
110 | struct ocfs2_live_connection { | 115 | struct ocfs2_live_connection { |
111 | struct list_head oc_list; | 116 | struct list_head oc_list; |
112 | struct ocfs2_cluster_connection *oc_conn; | 117 | struct ocfs2_cluster_connection *oc_conn; |
118 | enum ocfs2_connection_type oc_type; | ||
113 | atomic_t oc_this_node; | 119 | atomic_t oc_this_node; |
114 | int oc_our_slot; | 120 | int oc_our_slot; |
115 | }; | 121 | }; |
@@ -840,6 +846,7 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn) | |||
840 | goto out; | 846 | goto out; |
841 | } | 847 | } |
842 | 848 | ||
849 | lc->oc_type = WITH_CONTROLD; | ||
843 | rc = ocfs2_live_connection_attach(conn, lc); | 850 | rc = ocfs2_live_connection_attach(conn, lc); |
844 | if (rc) | 851 | if (rc) |
845 | goto out; | 852 | goto out; |
@@ -886,11 +893,16 @@ static int user_cluster_disconnect(struct ocfs2_cluster_connection *conn) | |||
886 | return 0; | 893 | return 0; |
887 | } | 894 | } |
888 | 895 | ||
889 | static int user_cluster_this_node(unsigned int *this_node) | 896 | static int user_cluster_this_node(struct ocfs2_cluster_connection *conn, |
897 | unsigned int *this_node) | ||
890 | { | 898 | { |
891 | int rc; | 899 | int rc; |
900 | struct ocfs2_live_connection *lc = conn->cc_private; | ||
892 | 901 | ||
893 | rc = ocfs2_control_get_this_node(); | 902 | if (lc->oc_type == WITH_CONTROLD) |
903 | rc = ocfs2_control_get_this_node(); | ||
904 | else | ||
905 | rc = -EINVAL; | ||
894 | if (rc < 0) | 906 | if (rc < 0) |
895 | return rc; | 907 | return rc; |
896 | 908 | ||
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c index 6537979b8ac4..1324e6600e57 100644 --- a/fs/ocfs2/stackglue.c +++ b/fs/ocfs2/stackglue.c | |||
@@ -465,9 +465,10 @@ void ocfs2_cluster_hangup(const char *group, int grouplen) | |||
465 | } | 465 | } |
466 | EXPORT_SYMBOL_GPL(ocfs2_cluster_hangup); | 466 | EXPORT_SYMBOL_GPL(ocfs2_cluster_hangup); |
467 | 467 | ||
468 | int ocfs2_cluster_this_node(unsigned int *node) | 468 | int ocfs2_cluster_this_node(struct ocfs2_cluster_connection *conn, |
469 | unsigned int *node) | ||
469 | { | 470 | { |
470 | return active_stack->sp_ops->this_node(node); | 471 | return active_stack->sp_ops->this_node(conn, node); |
471 | } | 472 | } |
472 | EXPORT_SYMBOL_GPL(ocfs2_cluster_this_node); | 473 | EXPORT_SYMBOL_GPL(ocfs2_cluster_this_node); |
473 | 474 | ||
diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h index 6d90f4192c14..66334a30cea8 100644 --- a/fs/ocfs2/stackglue.h +++ b/fs/ocfs2/stackglue.h | |||
@@ -157,7 +157,8 @@ struct ocfs2_stack_operations { | |||
157 | * ->this_node() returns the cluster's unique identifier for the | 157 | * ->this_node() returns the cluster's unique identifier for the |
158 | * local node. | 158 | * local node. |
159 | */ | 159 | */ |
160 | int (*this_node)(unsigned int *node); | 160 | int (*this_node)(struct ocfs2_cluster_connection *conn, |
161 | unsigned int *node); | ||
161 | 162 | ||
162 | /* | 163 | /* |
163 | * Call the underlying dlm lock function. The ->dlm_lock() | 164 | * Call the underlying dlm lock function. The ->dlm_lock() |
@@ -267,7 +268,8 @@ int ocfs2_cluster_connect_agnostic(const char *group, | |||
267 | int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn, | 268 | int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn, |
268 | int hangup_pending); | 269 | int hangup_pending); |
269 | void ocfs2_cluster_hangup(const char *group, int grouplen); | 270 | void ocfs2_cluster_hangup(const char *group, int grouplen); |
270 | int ocfs2_cluster_this_node(unsigned int *node); | 271 | int ocfs2_cluster_this_node(struct ocfs2_cluster_connection *conn, |
272 | unsigned int *node); | ||
271 | 273 | ||
272 | struct ocfs2_lock_res; | 274 | struct ocfs2_lock_res; |
273 | int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn, | 275 | int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn, |