summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2025-08-22 01:14:38 +0200
committerSteve French <stfrench@microsoft.com>2025-09-28 18:29:50 -0500
commitb8a5d5d1aa00728a4604cc2c2775c0664e821173 (patch)
treeda873299ddf4fdc8509042ae3a967db20a8370fd
parent163e0ff8c6e1ba5d436e125291d05951dcc6ba1c (diff)
downloadlinux-b8a5d5d1aa00728a4604cc2c2775c0664e821173.tar.gz
linux-b8a5d5d1aa00728a4604cc2c2775c0664e821173.zip
smb: client: pass struct smbdirect_socket to {allocate,destroy}_caches_and_workqueue()
This will make it easier to move function to the common code in future. Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/smbdirect.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c
index 91bdf1e34f8c..0ac4b76ed76b 100644
--- a/fs/smb/client/smbdirect.c
+++ b/fs/smb/client/smbdirect.c
@@ -1643,10 +1643,8 @@ create_conn:
return -ENOENT;
}
-static void destroy_caches_and_workqueue(struct smbd_connection *info)
+static void destroy_caches_and_workqueue(struct smbdirect_socket *sc)
{
- struct smbdirect_socket *sc = &info->socket;
-
destroy_receive_buffers(sc);
destroy_workqueue(sc->workqueue);
mempool_destroy(sc->recv_io.mem.pool);
@@ -1656,9 +1654,8 @@ static void destroy_caches_and_workqueue(struct smbd_connection *info)
}
#define MAX_NAME_LEN 80
-static int allocate_caches_and_workqueue(struct smbd_connection *info)
+static int allocate_caches_and_workqueue(struct smbdirect_socket *sc)
{
- struct smbdirect_socket *sc = &info->socket;
struct smbdirect_socket_parameters *sp = &sc->parameters;
char name[MAX_NAME_LEN];
int rc;
@@ -1666,7 +1663,7 @@ static int allocate_caches_and_workqueue(struct smbd_connection *info)
if (WARN_ON_ONCE(sp->max_recv_size < sizeof(struct smbdirect_data_transfer)))
return -ENOMEM;
- scnprintf(name, MAX_NAME_LEN, "smbdirect_send_io_%p", info);
+ scnprintf(name, MAX_NAME_LEN, "smbdirect_send_io_%p", sc);
sc->send_io.mem.cache =
kmem_cache_create(
name,
@@ -1682,7 +1679,7 @@ static int allocate_caches_and_workqueue(struct smbd_connection *info)
if (!sc->send_io.mem.pool)
goto out1;
- scnprintf(name, MAX_NAME_LEN, "smbdirect_recv_io_%p", info);
+ scnprintf(name, MAX_NAME_LEN, "smbdirect_recv_io_%p", sc);
struct kmem_cache_args response_args = {
.align = __alignof__(struct smbdirect_recv_io),
@@ -1703,7 +1700,7 @@ static int allocate_caches_and_workqueue(struct smbd_connection *info)
if (!sc->recv_io.mem.pool)
goto out3;
- scnprintf(name, MAX_NAME_LEN, "smbd_%p", info);
+ scnprintf(name, MAX_NAME_LEN, "smbd_%p", sc);
sc->workqueue = create_workqueue(name);
if (!sc->workqueue)
goto out4;
@@ -1889,7 +1886,7 @@ static struct smbd_connection *_smbd_get_connection(
log_rdma_event(INFO, "rdma_connect connected\n");
- rc = allocate_caches_and_workqueue(info);
+ rc = allocate_caches_and_workqueue(sc);
if (rc) {
log_rdma_event(ERR, "cache allocation failed\n");
goto allocate_cache_failed;
@@ -1929,7 +1926,7 @@ allocate_mr_failed:
negotiation_failed:
disable_delayed_work_sync(&sc->idle.timer_work);
- destroy_caches_and_workqueue(info);
+ destroy_caches_and_workqueue(sc);
sc->status = SMBDIRECT_SOCKET_NEGOTIATE_FAILED;
rdma_disconnect(sc->rdma.cm_id);
wait_event(sc->status_wait,