diff options
| author | Stefan Metzmacher <metze@samba.org> | 2025-08-11 15:19:51 +0200 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2025-09-28 18:29:52 -0500 |
| commit | fd0ad9c521db6acf20fb24699830138481c07f8a (patch) | |
| tree | 2260e6cedb77ef07e010116080fbfac5c524d6eb | |
| parent | bb12617ecb3af1e1c8ba36ef2c3496f95521a605 (diff) | |
| download | linux-fd0ad9c521db6acf20fb24699830138481c07f8a.tar.gz linux-fd0ad9c521db6acf20fb24699830138481c07f8a.zip | |
smb: server: make use of smbdirect_socket.send_io.pending.{count,zero_wait_queue}
This will is used by the client already and will allow to create
common helper functions.
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
| -rw-r--r-- | fs/smb/server/transport_rdma.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/fs/smb/server/transport_rdma.c b/fs/smb/server/transport_rdma.c index 1e14b038a77f..d8f0f252e401 100644 --- a/fs/smb/server/transport_rdma.c +++ b/fs/smb/server/transport_rdma.c @@ -106,9 +106,6 @@ struct smb_direct_transport { wait_queue_head_t wait_send_credits; wait_queue_head_t wait_rw_credits; - wait_queue_head_t wait_send_pending; - atomic_t send_pending; - struct work_struct post_recv_credits_work; struct work_struct send_immediate_work; @@ -342,9 +339,6 @@ static struct smb_direct_transport *alloc_transport(struct rdma_cm_id *cm_id) spin_lock_init(&t->receive_credit_lock); - init_waitqueue_head(&t->wait_send_pending); - atomic_set(&t->send_pending, 0); - spin_lock_init(&t->lock_new_recv_credits); INIT_WORK(&t->post_recv_credits_work, @@ -381,7 +375,7 @@ static void free_transport(struct smb_direct_transport *t) } wake_up_all(&t->wait_send_credits); - wake_up_all(&t->wait_send_pending); + wake_up_all(&sc->send_io.pending.zero_wait_queue); disable_work_sync(&t->post_recv_credits_work); disable_work_sync(&t->send_immediate_work); @@ -847,8 +841,8 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc) smb_direct_disconnect_rdma_connection(t); } - if (atomic_dec_and_test(&t->send_pending)) - wake_up(&t->wait_send_pending); + if (atomic_dec_and_test(&sc->send_io.pending.count)) + wake_up(&sc->send_io.pending.zero_wait_queue); /* iterate and free the list of messages in reverse. the list's head * is invalid. @@ -881,12 +875,12 @@ static int smb_direct_post_send(struct smb_direct_transport *t, struct smbdirect_socket *sc = &t->socket; int ret; - atomic_inc(&t->send_pending); + atomic_inc(&sc->send_io.pending.count); ret = ib_post_send(sc->ib.qp, wr, NULL); if (ret) { pr_err("failed to post send: %d\n", ret); - if (atomic_dec_and_test(&t->send_pending)) - wake_up(&t->wait_send_pending); + if (atomic_dec_and_test(&sc->send_io.pending.count)) + wake_up(&sc->send_io.pending.zero_wait_queue); smb_direct_disconnect_rdma_connection(t); } return ret; @@ -1344,8 +1338,8 @@ done: * that means all the I/Os have been out and we are good to return */ - wait_event(st->wait_send_pending, - atomic_read(&st->send_pending) == 0 || + wait_event(sc->send_io.pending.zero_wait_queue, + atomic_read(&sc->send_io.pending.count) == 0 || sc->status != SMBDIRECT_SOCKET_CONNECTED); if (sc->status != SMBDIRECT_SOCKET_CONNECTED && ret == 0) ret = -ENOTCONN; @@ -1681,8 +1675,8 @@ static int smb_direct_send_negotiate_response(struct smb_direct_transport *t, return ret; } - wait_event(t->wait_send_pending, - atomic_read(&t->send_pending) == 0 || + wait_event(sc->send_io.pending.zero_wait_queue, + atomic_read(&sc->send_io.pending.count) == 0 || sc->status != SMBDIRECT_SOCKET_CONNECTED); if (sc->status != SMBDIRECT_SOCKET_CONNECTED) return -ENOTCONN; |
