[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>
This commit is contained in:
committed by
Steven Whitehouse
parent
f01963f264
commit
7e4dac3359
@@ -2301,14 +2301,45 @@ int dlm_unlock(dlm_lockspace_t *lockspace,
|
|||||||
* receive_lookup_reply send_lookup_reply
|
* receive_lookup_reply send_lookup_reply
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static int _create_message(struct dlm_ls *ls, int mb_len,
|
||||||
|
int to_nodeid, int mstype,
|
||||||
|
struct dlm_message **ms_ret,
|
||||||
|
struct dlm_mhandle **mh_ret)
|
||||||
|
{
|
||||||
|
struct dlm_message *ms;
|
||||||
|
struct dlm_mhandle *mh;
|
||||||
|
char *mb;
|
||||||
|
|
||||||
|
/* get_buffer gives us a message handle (mh) that we need to
|
||||||
|
pass into lowcomms_commit and a message buffer (mb) that we
|
||||||
|
write our data into */
|
||||||
|
|
||||||
|
mh = dlm_lowcomms_get_buffer(to_nodeid, mb_len, GFP_KERNEL, &mb);
|
||||||
|
if (!mh)
|
||||||
|
return -ENOBUFS;
|
||||||
|
|
||||||
|
memset(mb, 0, mb_len);
|
||||||
|
|
||||||
|
ms = (struct dlm_message *) mb;
|
||||||
|
|
||||||
|
ms->m_header.h_version = (DLM_HEADER_MAJOR | DLM_HEADER_MINOR);
|
||||||
|
ms->m_header.h_lockspace = ls->ls_global_id;
|
||||||
|
ms->m_header.h_nodeid = dlm_our_nodeid();
|
||||||
|
ms->m_header.h_length = mb_len;
|
||||||
|
ms->m_header.h_cmd = DLM_MSG;
|
||||||
|
|
||||||
|
ms->m_type = mstype;
|
||||||
|
|
||||||
|
*mh_ret = mh;
|
||||||
|
*ms_ret = ms;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb,
|
static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb,
|
||||||
int to_nodeid, int mstype,
|
int to_nodeid, int mstype,
|
||||||
struct dlm_message **ms_ret,
|
struct dlm_message **ms_ret,
|
||||||
struct dlm_mhandle **mh_ret)
|
struct dlm_mhandle **mh_ret)
|
||||||
{
|
{
|
||||||
struct dlm_message *ms;
|
|
||||||
struct dlm_mhandle *mh;
|
|
||||||
char *mb;
|
|
||||||
int mb_len = sizeof(struct dlm_message);
|
int mb_len = sizeof(struct dlm_message);
|
||||||
|
|
||||||
switch (mstype) {
|
switch (mstype) {
|
||||||
@@ -2327,29 +2358,8 @@ static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get_buffer gives us a message handle (mh) that we need to
|
return _create_message(r->res_ls, mb_len, to_nodeid, mstype,
|
||||||
pass into lowcomms_commit and a message buffer (mb) that we
|
ms_ret, mh_ret);
|
||||||
write our data into */
|
|
||||||
|
|
||||||
mh = dlm_lowcomms_get_buffer(to_nodeid, mb_len, GFP_KERNEL, &mb);
|
|
||||||
if (!mh)
|
|
||||||
return -ENOBUFS;
|
|
||||||
|
|
||||||
memset(mb, 0, mb_len);
|
|
||||||
|
|
||||||
ms = (struct dlm_message *) mb;
|
|
||||||
|
|
||||||
ms->m_header.h_version = (DLM_HEADER_MAJOR | DLM_HEADER_MINOR);
|
|
||||||
ms->m_header.h_lockspace = r->res_ls->ls_global_id;
|
|
||||||
ms->m_header.h_nodeid = dlm_our_nodeid();
|
|
||||||
ms->m_header.h_length = mb_len;
|
|
||||||
ms->m_header.h_cmd = DLM_MSG;
|
|
||||||
|
|
||||||
ms->m_type = mstype;
|
|
||||||
|
|
||||||
*mh_ret = mh;
|
|
||||||
*ms_ret = ms;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* further lowcomms enhancements or alternate implementations may make
|
/* further lowcomms enhancements or alternate implementations may make
|
||||||
|
Reference in New Issue
Block a user