aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/requestqueue.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-01-25 00:28:28 -0500
committerDavid Teigland <teigland@redhat.com>2008-02-04 02:21:32 -0500
commit8b0d8e03f847d9c1677b8a193cd124debbc54633 (patch)
treee2b63705b4a4901f827c92f47acff9abd26875b8 /fs/dlm/requestqueue.c
parent8af03e782cae1e0a0f530ddd22301cdd12cf9dc0 (diff)
dlm: use proper C for dlm/requestqueue stuff (and fix alignment bug)
a) don't cast the pointer to dlm_header *, we use it as dlm_message * anyway. b) we copy the message into a queue element, then pass the pointer to copy to dlm_receive_message_saved(); declare it properly to make sure that we have the right alignment. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/requestqueue.c')
-rw-r--r--fs/dlm/requestqueue.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c
index 0de04f17ccea..daa4183fbb84 100644
--- a/fs/dlm/requestqueue.c
+++ b/fs/dlm/requestqueue.c
@@ -20,7 +20,7 @@
20struct rq_entry { 20struct rq_entry {
21 struct list_head list; 21 struct list_head list;
22 int nodeid; 22 int nodeid;
23 char request[0]; 23 struct dlm_message request;
24}; 24};
25 25
26/* 26/*
@@ -30,10 +30,10 @@ struct rq_entry {
30 * lockspace is enabled on some while still suspended on others. 30 * lockspace is enabled on some while still suspended on others.
31 */ 31 */
32 32
33void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_header *hd) 33void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_message *ms)
34{ 34{
35 struct rq_entry *e; 35 struct rq_entry *e;
36 int length = hd->h_length; 36 int length = ms->m_header.h_length - sizeof(struct dlm_message);
37 37
38 e = kmalloc(sizeof(struct rq_entry) + length, GFP_KERNEL); 38 e = kmalloc(sizeof(struct rq_entry) + length, GFP_KERNEL);
39 if (!e) { 39 if (!e) {
@@ -42,7 +42,7 @@ void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_header *hd)
42 } 42 }
43 43
44 e->nodeid = nodeid; 44 e->nodeid = nodeid;
45 memcpy(e->request, hd, length); 45 memcpy(&e->request, ms, ms->m_header.h_length);
46 46
47 mutex_lock(&ls->ls_requestqueue_mutex); 47 mutex_lock(&ls->ls_requestqueue_mutex);
48 list_add_tail(&e->list, &ls->ls_requestqueue); 48 list_add_tail(&e->list, &ls->ls_requestqueue);
@@ -76,7 +76,7 @@ int dlm_process_requestqueue(struct dlm_ls *ls)
76 e = list_entry(ls->ls_requestqueue.next, struct rq_entry, list); 76 e = list_entry(ls->ls_requestqueue.next, struct rq_entry, list);
77 mutex_unlock(&ls->ls_requestqueue_mutex); 77 mutex_unlock(&ls->ls_requestqueue_mutex);
78 78
79 dlm_receive_message_saved(ls, (struct dlm_message *)e->request); 79 dlm_receive_message_saved(ls, &e->request);
80 80
81 mutex_lock(&ls->ls_requestqueue_mutex); 81 mutex_lock(&ls->ls_requestqueue_mutex);
82 list_del(&e->list); 82 list_del(&e->list);
@@ -176,7 +176,7 @@ void dlm_purge_requestqueue(struct dlm_ls *ls)
176 176
177 mutex_lock(&ls->ls_requestqueue_mutex); 177 mutex_lock(&ls->ls_requestqueue_mutex);
178 list_for_each_entry_safe(e, safe, &ls->ls_requestqueue, list) { 178 list_for_each_entry_safe(e, safe, &ls->ls_requestqueue, list) {
179 ms = (struct dlm_message *) e->request; 179 ms = &e->request;
180 180
181 if (purge_request(ls, ms, e->nodeid)) { 181 if (purge_request(ls, ms, e->nodeid)) {
182 list_del(&e->list); 182 list_del(&e->list);