Commit e1711fe3 authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland

fs: dlm: allow different allocation context per _create_message

This patch allows to give the use control about the allocation context
based on a per message basis. Currently all messages forced to be
created under GFP_NOFS context.
Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 61bed0ba
...@@ -3554,7 +3554,8 @@ int dlm_unlock(dlm_lockspace_t *lockspace, ...@@ -3554,7 +3554,8 @@ int dlm_unlock(dlm_lockspace_t *lockspace,
static int _create_message(struct dlm_ls *ls, int mb_len, static int _create_message(struct dlm_ls *ls, int mb_len,
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,
gfp_t allocation)
{ {
struct dlm_message *ms; struct dlm_message *ms;
struct dlm_mhandle *mh; struct dlm_mhandle *mh;
...@@ -3564,7 +3565,7 @@ static int _create_message(struct dlm_ls *ls, int mb_len, ...@@ -3564,7 +3565,7 @@ static int _create_message(struct dlm_ls *ls, int mb_len,
pass into midcomms_commit and a message buffer (mb) that we pass into midcomms_commit and a message buffer (mb) that we
write our data into */ write our data into */
mh = dlm_midcomms_get_mhandle(to_nodeid, mb_len, GFP_NOFS, &mb); mh = dlm_midcomms_get_mhandle(to_nodeid, mb_len, allocation, &mb);
if (!mh) if (!mh)
return -ENOBUFS; return -ENOBUFS;
...@@ -3586,7 +3587,8 @@ static int _create_message(struct dlm_ls *ls, int mb_len, ...@@ -3586,7 +3587,8 @@ static int _create_message(struct dlm_ls *ls, int mb_len,
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,
gfp_t allocation)
{ {
int mb_len = sizeof(struct dlm_message); int mb_len = sizeof(struct dlm_message);
...@@ -3607,7 +3609,7 @@ static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb, ...@@ -3607,7 +3609,7 @@ static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb,
} }
return _create_message(r->res_ls, mb_len, to_nodeid, mstype, return _create_message(r->res_ls, mb_len, to_nodeid, mstype,
ms_ret, mh_ret); ms_ret, mh_ret, allocation);
} }
/* further lowcomms enhancements or alternate implementations may make /* further lowcomms enhancements or alternate implementations may make
...@@ -3676,7 +3678,7 @@ static int send_common(struct dlm_rsb *r, struct dlm_lkb *lkb, int mstype) ...@@ -3676,7 +3678,7 @@ static int send_common(struct dlm_rsb *r, struct dlm_lkb *lkb, int mstype)
if (error) if (error)
return error; return error;
error = create_message(r, lkb, to_nodeid, mstype, &ms, &mh); error = create_message(r, lkb, to_nodeid, mstype, &ms, &mh, GFP_NOFS);
if (error) if (error)
goto fail; goto fail;
...@@ -3737,7 +3739,8 @@ static int send_grant(struct dlm_rsb *r, struct dlm_lkb *lkb) ...@@ -3737,7 +3739,8 @@ static int send_grant(struct dlm_rsb *r, struct dlm_lkb *lkb)
to_nodeid = lkb->lkb_nodeid; to_nodeid = lkb->lkb_nodeid;
error = create_message(r, lkb, to_nodeid, DLM_MSG_GRANT, &ms, &mh); error = create_message(r, lkb, to_nodeid, DLM_MSG_GRANT, &ms, &mh,
GFP_NOFS);
if (error) if (error)
goto out; goto out;
...@@ -3758,7 +3761,8 @@ static int send_bast(struct dlm_rsb *r, struct dlm_lkb *lkb, int mode) ...@@ -3758,7 +3761,8 @@ static int send_bast(struct dlm_rsb *r, struct dlm_lkb *lkb, int mode)
to_nodeid = lkb->lkb_nodeid; to_nodeid = lkb->lkb_nodeid;
error = create_message(r, NULL, to_nodeid, DLM_MSG_BAST, &ms, &mh); error = create_message(r, NULL, to_nodeid, DLM_MSG_BAST, &ms, &mh,
GFP_NOFS);
if (error) if (error)
goto out; goto out;
...@@ -3783,7 +3787,8 @@ static int send_lookup(struct dlm_rsb *r, struct dlm_lkb *lkb) ...@@ -3783,7 +3787,8 @@ static int send_lookup(struct dlm_rsb *r, struct dlm_lkb *lkb)
if (error) if (error)
return error; return error;
error = create_message(r, NULL, to_nodeid, DLM_MSG_LOOKUP, &ms, &mh); error = create_message(r, NULL, to_nodeid, DLM_MSG_LOOKUP, &ms, &mh,
GFP_NOFS);
if (error) if (error)
goto fail; goto fail;
...@@ -3807,7 +3812,8 @@ static int send_remove(struct dlm_rsb *r) ...@@ -3807,7 +3812,8 @@ static int send_remove(struct dlm_rsb *r)
to_nodeid = dlm_dir_nodeid(r); to_nodeid = dlm_dir_nodeid(r);
error = create_message(r, NULL, to_nodeid, DLM_MSG_REMOVE, &ms, &mh); error = create_message(r, NULL, to_nodeid, DLM_MSG_REMOVE, &ms, &mh,
GFP_NOFS);
if (error) if (error)
goto out; goto out;
...@@ -3828,7 +3834,7 @@ static int send_common_reply(struct dlm_rsb *r, struct dlm_lkb *lkb, ...@@ -3828,7 +3834,7 @@ static int send_common_reply(struct dlm_rsb *r, struct dlm_lkb *lkb,
to_nodeid = lkb->lkb_nodeid; to_nodeid = lkb->lkb_nodeid;
error = create_message(r, lkb, to_nodeid, mstype, &ms, &mh); error = create_message(r, lkb, to_nodeid, mstype, &ms, &mh, GFP_NOFS);
if (error) if (error)
goto out; goto out;
...@@ -3869,7 +3875,8 @@ static int send_lookup_reply(struct dlm_ls *ls, struct dlm_message *ms_in, ...@@ -3869,7 +3875,8 @@ static int send_lookup_reply(struct dlm_ls *ls, struct dlm_message *ms_in,
struct dlm_mhandle *mh; struct dlm_mhandle *mh;
int error, nodeid = le32_to_cpu(ms_in->m_header.h_nodeid); int error, nodeid = le32_to_cpu(ms_in->m_header.h_nodeid);
error = create_message(r, NULL, nodeid, DLM_MSG_LOOKUP_REPLY, &ms, &mh); error = create_message(r, NULL, nodeid, DLM_MSG_LOOKUP_REPLY, &ms, &mh,
GFP_NOFS);
if (error) if (error)
goto out; goto out;
...@@ -6295,7 +6302,7 @@ static int send_purge(struct dlm_ls *ls, int nodeid, int pid) ...@@ -6295,7 +6302,7 @@ static int send_purge(struct dlm_ls *ls, int nodeid, int pid)
int error; int error;
error = _create_message(ls, sizeof(struct dlm_message), nodeid, error = _create_message(ls, sizeof(struct dlm_message), nodeid,
DLM_MSG_PURGE, &ms, &mh); DLM_MSG_PURGE, &ms, &mh, GFP_NOFS);
if (error) if (error)
return error; return error;
ms->m_nodeid = cpu_to_le32(nodeid); ms->m_nodeid = cpu_to_le32(nodeid);
......
...@@ -134,9 +134,9 @@ void dlm_free_lkb(struct dlm_lkb *lkb) ...@@ -134,9 +134,9 @@ void dlm_free_lkb(struct dlm_lkb *lkb)
kmem_cache_free(lkb_cache, lkb); kmem_cache_free(lkb_cache, lkb);
} }
struct dlm_mhandle *dlm_allocate_mhandle(void) struct dlm_mhandle *dlm_allocate_mhandle(gfp_t allocation)
{ {
return kmem_cache_alloc(mhandle_cache, GFP_NOFS); return kmem_cache_alloc(mhandle_cache, allocation);
} }
void dlm_free_mhandle(struct dlm_mhandle *mhandle) void dlm_free_mhandle(struct dlm_mhandle *mhandle)
......
...@@ -20,7 +20,7 @@ struct dlm_lkb *dlm_allocate_lkb(struct dlm_ls *ls); ...@@ -20,7 +20,7 @@ struct dlm_lkb *dlm_allocate_lkb(struct dlm_ls *ls);
void dlm_free_lkb(struct dlm_lkb *l); void dlm_free_lkb(struct dlm_lkb *l);
char *dlm_allocate_lvb(struct dlm_ls *ls); char *dlm_allocate_lvb(struct dlm_ls *ls);
void dlm_free_lvb(char *l); void dlm_free_lvb(char *l);
struct dlm_mhandle *dlm_allocate_mhandle(void); struct dlm_mhandle *dlm_allocate_mhandle(gfp_t allocation);
void dlm_free_mhandle(struct dlm_mhandle *mhandle); void dlm_free_mhandle(struct dlm_mhandle *mhandle);
struct writequeue_entry *dlm_allocate_writequeue(void); struct writequeue_entry *dlm_allocate_writequeue(void);
void dlm_free_writequeue(struct writequeue_entry *writequeue); void dlm_free_writequeue(struct writequeue_entry *writequeue);
......
...@@ -1097,7 +1097,7 @@ struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len, ...@@ -1097,7 +1097,7 @@ struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len,
/* this is a bug, however we going on and hope it will be resolved */ /* this is a bug, however we going on and hope it will be resolved */
WARN_ON(test_bit(DLM_NODE_FLAG_STOP_TX, &node->flags)); WARN_ON(test_bit(DLM_NODE_FLAG_STOP_TX, &node->flags));
mh = dlm_allocate_mhandle(); mh = dlm_allocate_mhandle(allocation);
if (!mh) if (!mh)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment