aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2007-04-02 10:06:41 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2007-05-01 04:11:07 -0400
commit7e4dac33594468153c38b5c94d8ebcafb0e0a68d (patch)
tree162910796a02f05843cafaf8a90a81330e66a122 /fs/dlm
parentf01963f2648cfd708ee8d521b3737cfa55ea8795 (diff)
[DLM] split create_message function
This splits the current create_message() function into two parts so that later patches can call the new lower-level _create_message() function when they don't have an rsb struct. No functional change in this patch. Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r--fs/dlm/lock.c54
1 files changed, 32 insertions, 22 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index b865a46059dd..7807958846c5 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -2301,31 +2301,14 @@ int dlm_unlock(dlm_lockspace_t *lockspace,
2301 * receive_lookup_reply send_lookup_reply 2301 * receive_lookup_reply send_lookup_reply
2302 */ 2302 */
2303 2303
2304static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb, 2304static int _create_message(struct dlm_ls *ls, int mb_len,
2305 int to_nodeid, int mstype, 2305 int to_nodeid, int mstype,
2306 struct dlm_message **ms_ret, 2306 struct dlm_message **ms_ret,
2307 struct dlm_mhandle **mh_ret) 2307 struct dlm_mhandle **mh_ret)
2308{ 2308{
2309 struct dlm_message *ms; 2309 struct dlm_message *ms;
2310 struct dlm_mhandle *mh; 2310 struct dlm_mhandle *mh;
2311 char *mb; 2311 char *mb;
2312 int mb_len = sizeof(struct dlm_message);
2313
2314 switch (mstype) {
2315 case DLM_MSG_REQUEST:
2316 case DLM_MSG_LOOKUP:
2317 case DLM_MSG_REMOVE:
2318 mb_len += r->res_length;
2319 break;
2320 case DLM_MSG_CONVERT:
2321 case DLM_MSG_UNLOCK:
2322 case DLM_MSG_REQUEST_REPLY:
2323 case DLM_MSG_CONVERT_REPLY:
2324 case DLM_MSG_GRANT:
2325 if (lkb && lkb->lkb_lvbptr)
2326 mb_len += r->res_ls->ls_lvblen;
2327 break;
2328 }
2329 2312
2330 /* get_buffer gives us a message handle (mh) that we need to 2313 /* get_buffer gives us a message handle (mh) that we need to
2331 pass into lowcomms_commit and a message buffer (mb) that we 2314 pass into lowcomms_commit and a message buffer (mb) that we
@@ -2340,7 +2323,7 @@ static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb,
2340 ms = (struct dlm_message *) mb; 2323 ms = (struct dlm_message *) mb;
2341 2324
2342 ms->m_header.h_version = (DLM_HEADER_MAJOR | DLM_HEADER_MINOR); 2325 ms->m_header.h_version = (DLM_HEADER_MAJOR | DLM_HEADER_MINOR);
2343 ms->m_header.h_lockspace = r->res_ls->ls_global_id; 2326 ms->m_header.h_lockspace = ls->ls_global_id;
2344 ms->m_header.h_nodeid = dlm_our_nodeid(); 2327 ms->m_header.h_nodeid = dlm_our_nodeid();
2345 ms->m_header.h_length = mb_len; 2328 ms->m_header.h_length = mb_len;
2346 ms->m_header.h_cmd = DLM_MSG; 2329 ms->m_header.h_cmd = DLM_MSG;
@@ -2352,6 +2335,33 @@ static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb,
2352 return 0; 2335 return 0;
2353} 2336}
2354 2337
2338static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb,
2339 int to_nodeid, int mstype,
2340 struct dlm_message **ms_ret,
2341 struct dlm_mhandle **mh_ret)
2342{
2343 int mb_len = sizeof(struct dlm_message);
2344
2345 switch (mstype) {
2346 case DLM_MSG_REQUEST:
2347 case DLM_MSG_LOOKUP:
2348 case DLM_MSG_REMOVE:
2349 mb_len += r->res_length;
2350 break;
2351 case DLM_MSG_CONVERT:
2352 case DLM_MSG_UNLOCK:
2353 case DLM_MSG_REQUEST_REPLY:
2354 case DLM_MSG_CONVERT_REPLY:
2355 case DLM_MSG_GRANT:
2356 if (lkb && lkb->lkb_lvbptr)
2357 mb_len += r->res_ls->ls_lvblen;
2358 break;
2359 }
2360
2361 return _create_message(r->res_ls, mb_len, to_nodeid, mstype,
2362 ms_ret, mh_ret);
2363}
2364
2355/* further lowcomms enhancements or alternate implementations may make 2365/* further lowcomms enhancements or alternate implementations may make
2356 the return value from this function useful at some point */ 2366 the return value from this function useful at some point */
2357 2367