Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

smb: smbdirect: prepare use of dedicated workqueues for different steps

This is a preparation in order to have global workqueues in
the smbdirect module instead of having the caller to
provide one.

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
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>

authored by

Stefan Metzmacher and committed by
Steve French
e4ce1fca 00ac2a4f

+33 -21
+4 -4
fs/smb/common/smbdirect/smbdirect_accept.c
··· 139 139 */ 140 140 INIT_DELAYED_WORK(&sc->idle.timer_work, smbdirect_connection_idle_timer_work); 141 141 sc->idle.keepalive = SMBDIRECT_KEEPALIVE_PENDING; 142 - mod_delayed_work(sc->workqueue, &sc->idle.timer_work, 142 + mod_delayed_work(sc->workqueues.idle, &sc->idle.timer_work, 143 143 msecs_to_jiffies(sp->negotiate_timeout_msec)); 144 144 145 145 return 0; ··· 272 272 if (!sc->first_error) { 273 273 INIT_WORK(&sc->connect.work, smbdirect_accept_negotiate_recv_work); 274 274 if (sc->status == SMBDIRECT_SOCKET_NEGOTIATE_NEEDED) 275 - queue_work(sc->workqueue, &sc->connect.work); 275 + queue_work(sc->workqueues.accept, &sc->connect.work); 276 276 } 277 277 spin_unlock_irqrestore(&sc->connect.lock, flags); 278 278 ··· 317 317 * order to trigger our next keepalive message. 318 318 */ 319 319 sc->idle.keepalive = SMBDIRECT_KEEPALIVE_NONE; 320 - mod_delayed_work(sc->workqueue, &sc->idle.timer_work, 320 + mod_delayed_work(sc->workqueues.idle, &sc->idle.timer_work, 321 321 msecs_to_jiffies(sp->keepalive_interval_msec)); 322 322 323 323 /* ··· 751 751 sc->status = SMBDIRECT_SOCKET_NEGOTIATE_NEEDED; 752 752 spin_lock_irqsave(&sc->connect.lock, flags); 753 753 if (!sc->first_error) 754 - queue_work(sc->workqueue, &sc->connect.work); 754 + queue_work(sc->workqueues.accept, &sc->connect.work); 755 755 spin_unlock_irqrestore(&sc->connect.lock, flags); 756 756 757 757 /*
+4 -4
fs/smb/common/smbdirect/smbdirect_connect.c
··· 234 234 */ 235 235 INIT_DELAYED_WORK(&sc->idle.timer_work, smbdirect_connection_idle_timer_work); 236 236 sc->idle.keepalive = SMBDIRECT_KEEPALIVE_PENDING; 237 - mod_delayed_work(sc->workqueue, &sc->idle.timer_work, 237 + mod_delayed_work(sc->workqueues.idle, &sc->idle.timer_work, 238 238 msecs_to_jiffies(sp->rdma_connect_timeout_msec)); 239 239 240 240 return 0; ··· 511 511 * so that the timer will cause a disconnect. 512 512 */ 513 513 sc->idle.keepalive = SMBDIRECT_KEEPALIVE_PENDING; 514 - mod_delayed_work(sc->workqueue, &sc->idle.timer_work, 514 + mod_delayed_work(sc->workqueues.idle, &sc->idle.timer_work, 515 515 msecs_to_jiffies(sp->negotiate_timeout_msec)); 516 516 517 517 return 0; ··· 632 632 if (!sc->first_error) { 633 633 INIT_WORK(&sc->connect.work, smbdirect_connect_negotiate_recv_work); 634 634 if (sc->status == SMBDIRECT_SOCKET_NEGOTIATE_RUNNING) 635 - queue_work(sc->workqueue, &sc->connect.work); 635 + queue_work(sc->workqueues.connect, &sc->connect.work); 636 636 } 637 637 spin_unlock_irqrestore(&sc->connect.lock, flags); 638 638 ··· 680 680 * order to trigger our next keepalive message. 681 681 */ 682 682 sc->idle.keepalive = SMBDIRECT_KEEPALIVE_NONE; 683 - mod_delayed_work(sc->workqueue, &sc->idle.timer_work, 683 + mod_delayed_work(sc->workqueues.idle, &sc->idle.timer_work, 684 684 msecs_to_jiffies(sp->keepalive_interval_msec)); 685 685 686 686 /*
+9 -9
fs/smb/common/smbdirect/smbdirect_connection.c
··· 614 614 sc->statistics.put_receive_buffer++; 615 615 spin_unlock_irqrestore(&sc->recv_io.free.lock, flags); 616 616 617 - queue_work(sc->workqueue, &sc->recv_io.posted.refill_work); 617 + queue_work(sc->workqueues.refill, &sc->recv_io.posted.refill_work); 618 618 } 619 619 620 620 __SMBDIRECT_PRIVATE__ ··· 822 822 * in order to wait for a response 823 823 */ 824 824 sc->idle.keepalive = SMBDIRECT_KEEPALIVE_PENDING; 825 - mod_delayed_work(sc->workqueue, &sc->idle.timer_work, 825 + mod_delayed_work(sc->workqueues.idle, &sc->idle.timer_work, 826 826 msecs_to_jiffies(sp->keepalive_timeout_msec)); 827 827 smbdirect_log_keep_alive(sc, SMBDIRECT_LOG_INFO, 828 828 "schedule send of empty idle message\n"); 829 - queue_work(sc->workqueue, &sc->idle.immediate_work); 829 + queue_work(sc->workqueues.immediate, &sc->idle.immediate_work); 830 830 } 831 831 832 832 __SMBDIRECT_PRIVATE__ ··· 878 878 * Now use the keepalive timeout (instead of keepalive interval) 879 879 * in order to wait for a response 880 880 */ 881 - mod_delayed_work(sc->workqueue, &sc->idle.timer_work, 881 + mod_delayed_work(sc->workqueues.idle, &sc->idle.timer_work, 882 882 msecs_to_jiffies(sp->keepalive_timeout_msec)); 883 883 return true; 884 884 } ··· 1167 1167 * get some new recv credits we can grant to 1168 1168 * the peer. 1169 1169 */ 1170 - queue_work(sc->workqueue, &sc->recv_io.posted.refill_work); 1170 + queue_work(sc->workqueues.refill, &sc->recv_io.posted.refill_work); 1171 1171 1172 1172 /* 1173 1173 * wait until either the refill work or the peer ··· 1568 1568 * order to trigger our next keepalive message. 1569 1569 */ 1570 1570 sc->idle.keepalive = SMBDIRECT_KEEPALIVE_NONE; 1571 - mod_delayed_work(sc->workqueue, &sc->idle.timer_work, 1571 + mod_delayed_work(sc->workqueues.idle, &sc->idle.timer_work, 1572 1572 msecs_to_jiffies(sp->keepalive_interval_msec)); 1573 1573 1574 1574 ib_dma_sync_single_for_cpu(sc->ib.dev, ··· 1673 1673 if (flags & SMBDIRECT_FLAG_RESPONSE_REQUESTED) { 1674 1674 smbdirect_log_keep_alive(sc, SMBDIRECT_LOG_INFO, 1675 1675 "schedule send of immediate response\n"); 1676 - queue_work(sc->workqueue, &sc->idle.immediate_work); 1676 + queue_work(sc->workqueues.immediate, &sc->idle.immediate_work); 1677 1677 } 1678 1678 1679 1679 /* ··· 1683 1683 if (data_length) { 1684 1684 if (current_recv_credits <= (sc->recv_io.credits.target / 4) || 1685 1685 sc->recv_io.credits.target > old_recv_credit_target) 1686 - queue_work(sc->workqueue, &sc->recv_io.posted.refill_work); 1686 + queue_work(sc->workqueues.refill, &sc->recv_io.posted.refill_work); 1687 1687 1688 1688 smbdirect_connection_reassembly_append_recv_io(sc, recv_io, data_length); 1689 1689 wake_up(&sc->recv_io.reassembly.wait_queue); ··· 1814 1814 if (posted > 0) { 1815 1815 smbdirect_log_keep_alive(sc, SMBDIRECT_LOG_INFO, 1816 1816 "schedule send of an empty message\n"); 1817 - queue_work(sc->workqueue, &sc->idle.immediate_work); 1817 + queue_work(sc->workqueues.immediate, &sc->idle.immediate_work); 1818 1818 } 1819 1819 } 1820 1820
+7 -2
fs/smb/common/smbdirect/smbdirect_socket.c
··· 242 242 /* 243 243 * Remember the callers workqueue 244 244 */ 245 - sc->workqueue = workqueue; 245 + sc->workqueues.accept = workqueue; 246 + sc->workqueues.connect = workqueue; 247 + sc->workqueues.idle = workqueue; 248 + sc->workqueues.refill = workqueue; 249 + sc->workqueues.immediate = workqueue; 250 + sc->workqueues.cleanup = workqueue; 246 251 247 252 return 0; 248 253 } ··· 424 419 */ 425 420 smbdirect_socket_wake_up_all(sc); 426 421 427 - queue_work(sc->workqueue, &sc->disconnect_work); 422 + queue_work(sc->workqueues.cleanup, &sc->disconnect_work); 428 423 } 429 424 430 425 static void smbdirect_socket_cleanup_work(struct work_struct *work)
+9 -2
fs/smb/common/smbdirect/smbdirect_socket.h
··· 109 109 int first_error; 110 110 111 111 /* 112 - * This points to the workqueue to 112 + * This points to the workqueues to 113 113 * be used for this socket. 114 114 * It can be per socket (on the client) 115 115 * or point to a global workqueue (on the server) 116 116 */ 117 - struct workqueue_struct *workqueue; 117 + struct { 118 + struct workqueue_struct *accept; 119 + struct workqueue_struct *connect; 120 + struct workqueue_struct *idle; 121 + struct workqueue_struct *refill; 122 + struct workqueue_struct *immediate; 123 + struct workqueue_struct *cleanup; 124 + } workqueues; 118 125 119 126 struct work_struct disconnect_work; 120 127