Skip to content

Commit 5950045

Browse files
metze-sambasmfrench
authored andcommitted
smb: client: make use of smb: smbdirect_socket.recv_io.free.{list,lock}
This will be used by the server too in order to have common helper functions in future. Cc: Steve French <[email protected]> Cc: Tom Talpey <[email protected]> Cc: Long Li <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Stefan Metzmacher <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent d0df32a commit 5950045

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

fs/smb/client/smbdirect.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,19 +1165,20 @@ static struct smbdirect_recv_io *_get_first_reassembly(struct smbd_connection *i
11651165
*/
11661166
static struct smbdirect_recv_io *get_receive_buffer(struct smbd_connection *info)
11671167
{
1168+
struct smbdirect_socket *sc = &info->socket;
11681169
struct smbdirect_recv_io *ret = NULL;
11691170
unsigned long flags;
11701171

1171-
spin_lock_irqsave(&info->receive_queue_lock, flags);
1172-
if (!list_empty(&info->receive_queue)) {
1172+
spin_lock_irqsave(&sc->recv_io.free.lock, flags);
1173+
if (!list_empty(&sc->recv_io.free.list)) {
11731174
ret = list_first_entry(
1174-
&info->receive_queue,
1175+
&sc->recv_io.free.list,
11751176
struct smbdirect_recv_io, list);
11761177
list_del(&ret->list);
11771178
info->count_receive_queue--;
11781179
info->count_get_receive_buffer++;
11791180
}
1180-
spin_unlock_irqrestore(&info->receive_queue_lock, flags);
1181+
spin_unlock_irqrestore(&sc->recv_io.free.lock, flags);
11811182

11821183
return ret;
11831184
}
@@ -1202,11 +1203,11 @@ static void put_receive_buffer(
12021203
response->sge.length = 0;
12031204
}
12041205

1205-
spin_lock_irqsave(&info->receive_queue_lock, flags);
1206-
list_add_tail(&response->list, &info->receive_queue);
1206+
spin_lock_irqsave(&sc->recv_io.free.lock, flags);
1207+
list_add_tail(&response->list, &sc->recv_io.free.list);
12071208
info->count_receive_queue++;
12081209
info->count_put_receive_buffer++;
1209-
spin_unlock_irqrestore(&info->receive_queue_lock, flags);
1210+
spin_unlock_irqrestore(&sc->recv_io.free.lock, flags);
12101211

12111212
queue_work(info->workqueue, &info->post_send_credits_work);
12121213
}
@@ -1223,8 +1224,8 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf)
12231224
info->reassembly_data_length = 0;
12241225
info->reassembly_queue_length = 0;
12251226

1226-
INIT_LIST_HEAD(&info->receive_queue);
1227-
spin_lock_init(&info->receive_queue_lock);
1227+
INIT_LIST_HEAD(&sc->recv_io.free.list);
1228+
spin_lock_init(&sc->recv_io.free.lock);
12281229
info->count_receive_queue = 0;
12291230

12301231
init_waitqueue_head(&info->wait_receive_queues);
@@ -1236,16 +1237,16 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf)
12361237

12371238
response->socket = sc;
12381239
response->sge.length = 0;
1239-
list_add_tail(&response->list, &info->receive_queue);
1240+
list_add_tail(&response->list, &sc->recv_io.free.list);
12401241
info->count_receive_queue++;
12411242
}
12421243

12431244
return 0;
12441245

12451246
allocate_failed:
1246-
while (!list_empty(&info->receive_queue)) {
1247+
while (!list_empty(&sc->recv_io.free.list)) {
12471248
response = list_first_entry(
1248-
&info->receive_queue,
1249+
&sc->recv_io.free.list,
12491250
struct smbdirect_recv_io, list);
12501251
list_del(&response->list);
12511252
info->count_receive_queue--;

fs/smb/client/smbdirect.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,7 @@ struct smbd_connection {
105105
wait_queue_head_t wait_post_send;
106106

107107
/* Receive queue */
108-
struct list_head receive_queue;
109108
int count_receive_queue;
110-
spinlock_t receive_queue_lock;
111-
112109
wait_queue_head_t wait_receive_queues;
113110

114111
/* Reassembly queue */

0 commit comments

Comments
 (0)