diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-01-25 00:28:28 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2008-02-04 02:21:32 -0500 |
commit | 8b0d8e03f847d9c1677b8a193cd124debbc54633 (patch) | |
tree | e2b63705b4a4901f827c92f47acff9abd26875b8 | |
parent | 8af03e782cae1e0a0f530ddd22301cdd12cf9dc0 (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>
-rw-r--r-- | fs/dlm/lock.c | 2 | ||||
-rw-r--r-- | fs/dlm/requestqueue.c | 12 | ||||
-rw-r--r-- | fs/dlm/requestqueue.h | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index ff4a198fa677..d9f07a42e3cf 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -3802,7 +3802,7 @@ static void dlm_receive_message(struct dlm_ls *ls, struct dlm_message *ms, | |||
3802 | int nodeid) | 3802 | int nodeid) |
3803 | { | 3803 | { |
3804 | if (dlm_locking_stopped(ls)) { | 3804 | if (dlm_locking_stopped(ls)) { |
3805 | dlm_add_requestqueue(ls, nodeid, (struct dlm_header *) ms); | 3805 | dlm_add_requestqueue(ls, nodeid, ms); |
3806 | } else { | 3806 | } else { |
3807 | dlm_wait_requestqueue(ls); | 3807 | dlm_wait_requestqueue(ls); |
3808 | _receive_message(ls, ms); | 3808 | _receive_message(ls, ms); |
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 @@ | |||
20 | struct rq_entry { | 20 | struct 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 | ||
33 | void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_header *hd) | 33 | void 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); |
diff --git a/fs/dlm/requestqueue.h b/fs/dlm/requestqueue.h index aba34fc05ee4..10ce449b77da 100644 --- a/fs/dlm/requestqueue.h +++ b/fs/dlm/requestqueue.h | |||
@@ -13,7 +13,7 @@ | |||
13 | #ifndef __REQUESTQUEUE_DOT_H__ | 13 | #ifndef __REQUESTQUEUE_DOT_H__ |
14 | #define __REQUESTQUEUE_DOT_H__ | 14 | #define __REQUESTQUEUE_DOT_H__ |
15 | 15 | ||
16 | void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_header *hd); | 16 | void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_message *ms); |
17 | int dlm_process_requestqueue(struct dlm_ls *ls); | 17 | int dlm_process_requestqueue(struct dlm_ls *ls); |
18 | void dlm_wait_requestqueue(struct dlm_ls *ls); | 18 | void dlm_wait_requestqueue(struct dlm_ls *ls); |
19 | void dlm_purge_requestqueue(struct dlm_ls *ls); | 19 | void dlm_purge_requestqueue(struct dlm_ls *ls); |