From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Aring Date: Wed, 27 Oct 2021 11:23:17 -0400 Subject: [Cluster-devel] [PATCH dlm/next 3/8] fs: dlm: let handle callback data as void In-Reply-To: <20211027152322.3236492-1-aahringo@redhat.com> References: <20211027152322.3236492-1-aahringo@redhat.com> Message-ID: <20211027152322.3236492-4-aahringo@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- fs/dlm/lowcomms.c | 19 +++++++++---------- fs/dlm/lowcomms.h | 4 ++-- fs/dlm/midcomms.c | 4 +++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 0ea9ae35da0b..5cfef47b7df2 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1478,8 +1478,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; @@ -1491,7 +1490,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++; @@ -1513,7 +1512,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); @@ -1523,8 +1522,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; @@ -1535,7 +1534,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) { kfree(msg); return NULL; @@ -1549,8 +1548,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; @@ -1571,7 +1570,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; diff --git a/fs/dlm/lowcomms.h b/fs/dlm/lowcomms.h index aaae7115c00d..94f5e5a81cd7 100644 --- a/fs/dlm/lowcomms.h +++ b/fs/dlm/lowcomms.h @@ -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); diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c index 6bcc5eb0f6cc..a8af5688ee89 100644 --- a/fs/dlm/midcomms.c +++ b/fs/dlm/midcomms.c @@ -980,8 +980,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); -- 2.27.0