Skip to content

Commit

Permalink
fs: dlm: let handle callback data as void
Browse files Browse the repository at this point in the history
This patch changes the dlm_lowcomms_new_msg() function pointer private data
from "struct mhandle *" to "void *" to provide different structures than
just "struct mhandle".

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
  • Loading branch information
Alexander Aring authored and David Teigland committed Nov 2, 2021
1 parent 3cb5977 commit 5c16feb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
19 changes: 9 additions & 10 deletions fs/dlm/lowcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -1205,8 +1205,7 @@ static struct writequeue_entry *new_writequeue_entry(struct connection *con,

static struct writequeue_entry *new_wq_entry(struct connection *con, int len,
gfp_t allocation, char **ppc,
void (*cb)(struct dlm_mhandle *mh),
struct dlm_mhandle *mh)
void (*cb)(void *data), void *data)
{
struct writequeue_entry *e;

Expand All @@ -1218,7 +1217,7 @@ static struct writequeue_entry *new_wq_entry(struct connection *con, int len,

*ppc = page_address(e->page) + e->end;
if (cb)
cb(mh);
cb(data);

e->end += len;
e->users++;
Expand All @@ -1240,7 +1239,7 @@ static struct writequeue_entry *new_wq_entry(struct connection *con, int len,

spin_lock(&con->writequeue_lock);
if (cb)
cb(mh);
cb(data);

list_add_tail(&e->list, &con->writequeue);
spin_unlock(&con->writequeue_lock);
Expand All @@ -1250,8 +1249,8 @@ static struct writequeue_entry *new_wq_entry(struct connection *con, int len,

static struct dlm_msg *dlm_lowcomms_new_msg_con(struct connection *con, int len,
gfp_t allocation, char **ppc,
void (*cb)(struct dlm_mhandle *mh),
struct dlm_mhandle *mh)
void (*cb)(void *data),
void *data)
{
struct writequeue_entry *e;
struct dlm_msg *msg;
Expand All @@ -1274,7 +1273,7 @@ static struct dlm_msg *dlm_lowcomms_new_msg_con(struct connection *con, int len,

kref_init(&msg->ref);

e = new_wq_entry(con, len, allocation, ppc, cb, mh);
e = new_wq_entry(con, len, allocation, ppc, cb, data);
if (!e) {
if (sleepable)
mutex_unlock(&con->wq_alloc);
Expand All @@ -1294,8 +1293,8 @@ static struct dlm_msg *dlm_lowcomms_new_msg_con(struct connection *con, int len,
}

struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation,
char **ppc, void (*cb)(struct dlm_mhandle *mh),
struct dlm_mhandle *mh)
char **ppc, void (*cb)(void *data),
void *data)
{
struct connection *con;
struct dlm_msg *msg;
Expand All @@ -1316,7 +1315,7 @@ struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation,
return NULL;
}

msg = dlm_lowcomms_new_msg_con(con, len, allocation, ppc, cb, mh);
msg = dlm_lowcomms_new_msg_con(con, len, allocation, ppc, cb, data);
if (!msg) {
srcu_read_unlock(&connections_srcu, idx);
return NULL;
Expand Down
4 changes: 2 additions & 2 deletions fs/dlm/lowcomms.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ void dlm_lowcomms_stop(void);
void dlm_lowcomms_exit(void);
int dlm_lowcomms_close(int nodeid);
struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation,
char **ppc, void (*cb)(struct dlm_mhandle *mh),
struct dlm_mhandle *mh);
char **ppc, void (*cb)(void *data),
void *data);
void dlm_lowcomms_commit_msg(struct dlm_msg *msg);
void dlm_lowcomms_put_msg(struct dlm_msg *msg);
int dlm_lowcomms_resend_msg(struct dlm_msg *msg);
Expand Down
4 changes: 3 additions & 1 deletion fs/dlm/midcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,8 +1020,10 @@ static void dlm_fill_opts_header(struct dlm_opts *opts, uint16_t inner_len,
header_out(&opts->o_header);
}

static void midcomms_new_msg_cb(struct dlm_mhandle *mh)
static void midcomms_new_msg_cb(void *data)
{
struct dlm_mhandle *mh = data;

atomic_inc(&mh->node->send_queue_cnt);

spin_lock(&mh->node->send_queue_lock);
Expand Down

0 comments on commit 5c16feb

Please sign in to comment.