mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 21:15:53 +02:00
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>
This commit is contained in:
parent
163e0ff8c6
commit
b8a5d5d1aa
|
|
@ -1643,10 +1643,8 @@ int smbd_reconnect(struct TCP_Server_Info *server)
|
|||
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 @@ static struct smbd_connection *_smbd_get_connection(
|
|||
|
||||
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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user