]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.fixes/ocfs2-dlm-remove-struct-dlm_lock_name-in-struct-dlm.patch
Reenabled linux-xen and xen-image build
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.fixes / ocfs2-dlm-remove-struct-dlm_lock_name-in-struct-dlm.patch
CommitLineData
00e5a55c
BS
1From: Sunil Mushran <sunil.mushran@oracle.com>
2Date: Thu, 26 Feb 2009 15:00:47 -0800
3Subject: ocfs2/dlm: Remove struct dlm_lock_name in struct dlm_master_list_entry
4Patch-mainline: 2.6.30
5References: bnc#408304
6
7This patch removes struct dlm_lock_name and adds the entries directly
8to struct dlm_master_list_entry. Under the new scheme, both mles that
9are backed by a lockres or not, will have the name populated in mle->mname.
10This allows us to get rid of code that was figuring out the location of
11the mle name.
12
13Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
14Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15---
16 fs/ocfs2/dlm/dlmcommon.h | 14 +++-------
17 fs/ocfs2/dlm/dlmdebug.c | 12 +-------
18 fs/ocfs2/dlm/dlmmaster.c | 68 ++++++++++++---------------------------------
19 3 files changed, 23 insertions(+), 71 deletions(-)
20
21Index: linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmcommon.h
22===================================================================
23--- linux-2.6.27-sle11_ocfs2_update.orig/fs/ocfs2/dlm/dlmcommon.h
24+++ linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmcommon.h
25@@ -56,12 +56,6 @@ enum dlm_mle_type {
26 DLM_MLE_NUM_TYPES
27 };
28
29-struct dlm_lock_name {
30- unsigned int hash;
31- unsigned int len;
32- unsigned char name[DLM_LOCKID_NAME_MAX];
33-};
34-
35 struct dlm_master_list_entry {
36 struct hlist_node master_hash_node;
37 struct list_head hb_events;
38@@ -80,10 +74,10 @@ struct dlm_master_list_entry {
39 enum dlm_mle_type type;
40 struct o2hb_callback_func mle_hb_up;
41 struct o2hb_callback_func mle_hb_down;
42- union {
43- struct dlm_lock_resource *mleres;
44- struct dlm_lock_name mlename;
45- } u;
46+ struct dlm_lock_resource *mleres;
47+ unsigned char mname[DLM_LOCKID_NAME_MAX];
48+ unsigned int mnamelen;
49+ unsigned int mnamehash;
50 };
51
52 enum dlm_ast_type {
53Index: linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmdebug.c
54===================================================================
55--- linux-2.6.27-sle11_ocfs2_update.orig/fs/ocfs2/dlm/dlmdebug.c
56+++ linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmdebug.c
57@@ -287,18 +287,8 @@ static int stringify_nodemap(unsigned lo
58 static int dump_mle(struct dlm_master_list_entry *mle, char *buf, int len)
59 {
60 int out = 0;
61- unsigned int namelen;
62- unsigned char *name;
63 char *mle_type;
64
65- if (mle->type != DLM_MLE_MASTER) {
66- name = mle->u.mlename.name;
67- namelen = mle->u.mlename.len;
68- } else {
69- name = (unsigned char *)mle->u.mleres->lockname.name;
70- namelen = mle->u.mleres->lockname.len;
71- }
72-
73 if (mle->type == DLM_MLE_BLOCK)
74 mle_type = "BLK";
75 else if (mle->type == DLM_MLE_MASTER)
76@@ -306,7 +296,7 @@ static int dump_mle(struct dlm_master_li
77 else
78 mle_type = "MIG";
79
80- out += stringify_lockname(name, namelen, buf + out, len - out);
81+ out += stringify_lockname(mle->mname, mle->mnamelen, buf + out, len - out);
82 out += snprintf(buf + out, len - out,
83 "\t%3s\tmas=%3u\tnew=%3u\tevt=%1d\tuse=%1d\tref=%3d\n",
84 mle_type, mle->master, mle->new_master,
85Index: linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmmaster.c
86===================================================================
87--- linux-2.6.27-sle11_ocfs2_update.orig/fs/ocfs2/dlm/dlmmaster.c
88+++ linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmmaster.c
89@@ -68,41 +68,16 @@ static int dlm_do_assert_master(struct d
90 void *nodemap, u32 flags);
91 static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data);
92
93-static inline void __dlm_mle_name(struct dlm_master_list_entry *mle,
94- unsigned char **name, unsigned int *namelen,
95- unsigned int *namehash)
96-{
97- BUG_ON(mle->type != DLM_MLE_BLOCK &&
98- mle->type != DLM_MLE_MASTER &&
99- mle->type != DLM_MLE_MIGRATION);
100-
101- if (mle->type != DLM_MLE_MASTER) {
102- *name = mle->u.mlename.name;
103- *namelen = mle->u.mlename.len;
104- if (namehash)
105- *namehash = mle->u.mlename.hash;
106- } else {
107- *name = (unsigned char *)mle->u.mleres->lockname.name;
108- *namelen = mle->u.mleres->lockname.len;
109- if (namehash)
110- *namehash = mle->u.mleres->lockname.hash;
111- }
112-}
113-
114 static inline int dlm_mle_equal(struct dlm_ctxt *dlm,
115 struct dlm_master_list_entry *mle,
116 const char *name,
117 unsigned int namelen)
118 {
119- unsigned char *mlename;
120- unsigned int mlelen;
121-
122 if (dlm != mle->dlm)
123 return 0;
124
125- __dlm_mle_name(mle, &mlename, &mlelen, NULL);
126-
127- if (namelen != mlelen || memcmp(name, mlename, namelen) != 0)
128+ if (namelen != mle->mnamelen ||
129+ memcmp(name, mle->mname, namelen) != 0)
130 return 0;
131
132 return 1;
133@@ -317,12 +292,16 @@ static void dlm_init_mle(struct dlm_mast
134
135 if (mle->type == DLM_MLE_MASTER) {
136 BUG_ON(!res);
137- mle->u.mleres = res;
138+ mle->mleres = res;
139+ memcpy(mle->mname, res->lockname.name, res->lockname.len);
140+ mle->mnamelen = res->lockname.len;
141+ mle->mnamehash = res->lockname.hash;
142 } else {
143 BUG_ON(!name);
144- memcpy(mle->u.mlename.name, name, namelen);
145- mle->u.mlename.len = namelen;
146- mle->u.mlename.hash = dlm_lockid_hash(name, namelen);
147+ mle->mleres = NULL;
148+ memcpy(mle->mname, name, namelen);
149+ mle->mnamelen = namelen;
150+ mle->mnamehash = dlm_lockid_hash(name, namelen);
151 }
152
153 atomic_inc(&dlm->mle_tot_count[mle->type]);
154@@ -350,13 +329,10 @@ void __dlm_unlink_mle(struct dlm_ctxt *d
155 void __dlm_insert_mle(struct dlm_ctxt *dlm, struct dlm_master_list_entry *mle)
156 {
157 struct hlist_head *bucket;
158- unsigned char *mname;
159- unsigned int mlen, hash;
160
161 assert_spin_locked(&dlm->master_lock);
162
163- __dlm_mle_name(mle, &mname, &mlen, &hash);
164- bucket = dlm_master_hash(dlm, hash);
165+ bucket = dlm_master_hash(dlm, mle->mnamehash);
166 hlist_add_head(&mle->master_hash_node, bucket);
167 }
168
169@@ -450,8 +426,6 @@ static void dlm_mle_release(struct kref
170 {
171 struct dlm_master_list_entry *mle;
172 struct dlm_ctxt *dlm;
173- unsigned char *mname;
174- unsigned int mlen;
175
176 mlog_entry_void();
177
178@@ -461,8 +435,8 @@ static void dlm_mle_release(struct kref
179 assert_spin_locked(&dlm->spinlock);
180 assert_spin_locked(&dlm->master_lock);
181
182- __dlm_mle_name(mle, &mname, &mlen, NULL);
183- mlog(0, "Releasing mle for %.*s, type %d\n", mlen, mname, mle->type);
184+ mlog(0, "Releasing mle for %.*s, type %d\n", mle->mnamelen, mle->mname,
185+ mle->type);
186
187 /* remove from list if not already */
188 __dlm_unlink_mle(dlm, mle);
189@@ -1277,7 +1251,7 @@ static int dlm_restart_lock_mastery(stru
190 res->lockname.len,
191 res->lockname.name);
192 mle->type = DLM_MLE_MASTER;
193- mle->u.mleres = res;
194+ mle->mleres = res;
195 }
196 }
197 }
198@@ -1316,18 +1290,14 @@ static int dlm_do_master_request(struct
199 struct dlm_ctxt *dlm = mle->dlm;
200 struct dlm_master_request request;
201 int ret, response=0, resend;
202- unsigned char *mlename;
203- unsigned int mlenamelen;
204
205 memset(&request, 0, sizeof(request));
206 request.node_idx = dlm->node_num;
207
208 BUG_ON(mle->type == DLM_MLE_MIGRATION);
209
210- __dlm_mle_name(mle, &mlename, &mlenamelen, NULL);
211-
212- request.namelen = (u8)mlenamelen;
213- memcpy(request.name, mlename, request.namelen);
214+ request.namelen = (u8)mle->mnamelen;
215+ memcpy(request.name, mle->mname, request.namelen);
216
217 again:
218 ret = o2net_send_message(DLM_MASTER_REQUEST_MSG, dlm->key, &request,
219@@ -3181,12 +3151,10 @@ static struct dlm_lock_resource *dlm_res
220 struct dlm_master_list_entry *mle)
221 {
222 struct dlm_lock_resource *res;
223- unsigned int hash;
224
225 /* Find the lockres associated to the mle and set its owner to UNK */
226- hash = dlm_lockid_hash(mle->u.mlename.name, mle->u.mlename.len);
227- res = __dlm_lookup_lockres(dlm, mle->u.mlename.name, mle->u.mlename.len,
228- hash);
229+ res = __dlm_lookup_lockres(dlm, mle->mname, mle->mnamelen,
230+ mle->mnamehash);
231 if (res) {
232 spin_unlock(&dlm->master_lock);
233