Skip to content

Commit 76e342d

Browse files
Alexander Aringteigland
authored andcommitted
dlm: use dlm_config as only cluster configuration
This patch removes the configfs storage fields from the dlm_cluster structure to store per cluster values. Those fields also exists for the dlm_config global variable and get stored in both when setting configfs values. To read values it will always be read out from the dlm_cluster configfs structure but this patch changes it to only use the global dlm_config variable. Storing them in two places makes no sense as both are able to be changed under certain conditions during DLM runtime. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent f92a5be commit 76e342d

File tree

1 file changed

+5
-42
lines changed

1 file changed

+5
-42
lines changed

fs/dlm/config.c

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,6 @@ const struct rhashtable_params dlm_rhash_rsb_params = {
7373

7474
struct dlm_cluster {
7575
struct config_group group;
76-
__be16 cl_tcp_port;
77-
unsigned int cl_buffer_size;
78-
unsigned int cl_rsbtbl_size;
79-
unsigned int cl_recover_timer;
80-
unsigned int cl_toss_secs;
81-
unsigned int cl_scan_secs;
82-
unsigned int cl_log_debug;
83-
unsigned int cl_log_info;
84-
unsigned int cl_protocol;
85-
unsigned int cl_mark;
86-
unsigned int cl_new_rsb_count;
87-
unsigned int cl_recover_callbacks;
88-
char cl_cluster_name[DLM_LOCKSPACE_LEN];
89-
9076
struct dlm_spaces *sps;
9177
struct dlm_comms *cms;
9278
};
@@ -115,18 +101,14 @@ enum {
115101

116102
static ssize_t cluster_cluster_name_show(struct config_item *item, char *buf)
117103
{
118-
struct dlm_cluster *cl = config_item_to_cluster(item);
119-
return sprintf(buf, "%s\n", cl->cl_cluster_name);
104+
return sprintf(buf, "%s\n", dlm_config.ci_cluster_name);
120105
}
121106

122107
static ssize_t cluster_cluster_name_store(struct config_item *item,
123108
const char *buf, size_t len)
124109
{
125-
struct dlm_cluster *cl = config_item_to_cluster(item);
126-
127110
strscpy(dlm_config.ci_cluster_name, buf,
128-
sizeof(dlm_config.ci_cluster_name));
129-
strscpy(cl->cl_cluster_name, buf, sizeof(cl->cl_cluster_name));
111+
sizeof(dlm_config.ci_cluster_name));
130112
return len;
131113
}
132114

@@ -171,8 +153,7 @@ static ssize_t cluster_tcp_port_store(struct config_item *item,
171153

172154
CONFIGFS_ATTR(cluster_, tcp_port);
173155

174-
static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field,
175-
int *info_field, int (*check_cb)(unsigned int x),
156+
static ssize_t cluster_set(int *info_field, int (*check_cb)(unsigned int x),
176157
const char *buf, size_t len)
177158
{
178159
unsigned int x;
@@ -190,7 +171,6 @@ static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field,
190171
return rc;
191172
}
192173

193-
*cl_field = x;
194174
*info_field = x;
195175

196176
return len;
@@ -200,14 +180,11 @@ static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field,
200180
static ssize_t cluster_##name##_store(struct config_item *item, \
201181
const char *buf, size_t len) \
202182
{ \
203-
struct dlm_cluster *cl = config_item_to_cluster(item); \
204-
return cluster_set(cl, &cl->cl_##name, &dlm_config.ci_##name, \
205-
check_cb, buf, len); \
183+
return cluster_set(&dlm_config.ci_##name, check_cb, buf, len); \
206184
} \
207185
static ssize_t cluster_##name##_show(struct config_item *item, char *buf) \
208186
{ \
209-
struct dlm_cluster *cl = config_item_to_cluster(item); \
210-
return snprintf(buf, PAGE_SIZE, "%u\n", cl->cl_##name); \
187+
return snprintf(buf, PAGE_SIZE, "%u\n", dlm_config.ci_##name); \
211188
} \
212189
CONFIGFS_ATTR(cluster_, name);
213190

@@ -450,20 +427,6 @@ static struct config_group *make_cluster(struct config_group *g,
450427
configfs_add_default_group(&sps->ss_group, &cl->group);
451428
configfs_add_default_group(&cms->cs_group, &cl->group);
452429

453-
cl->cl_tcp_port = dlm_config.ci_tcp_port;
454-
cl->cl_buffer_size = dlm_config.ci_buffer_size;
455-
cl->cl_rsbtbl_size = dlm_config.ci_rsbtbl_size;
456-
cl->cl_recover_timer = dlm_config.ci_recover_timer;
457-
cl->cl_toss_secs = dlm_config.ci_toss_secs;
458-
cl->cl_scan_secs = dlm_config.ci_scan_secs;
459-
cl->cl_log_debug = dlm_config.ci_log_debug;
460-
cl->cl_log_info = dlm_config.ci_log_info;
461-
cl->cl_protocol = dlm_config.ci_protocol;
462-
cl->cl_new_rsb_count = dlm_config.ci_new_rsb_count;
463-
cl->cl_recover_callbacks = dlm_config.ci_recover_callbacks;
464-
memcpy(cl->cl_cluster_name, dlm_config.ci_cluster_name,
465-
DLM_LOCKSPACE_LEN);
466-
467430
space_list = &sps->ss_group;
468431
comm_list = &cms->cs_group;
469432
return &cl->group;

0 commit comments

Comments
 (0)