From: Stefan Metzmacher Date: Tue, 3 Feb 2026 18:26:43 +0000 (+0100) Subject: smb: smbdirect: introduce smbdirect_init_send_batch_storage() X-Git-Tag: v7.1-rc1~128^2~88 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=4c9e665cb1132b92812886d08ec784132eb66caf;p=thirdparty%2Fkernel%2Flinux.git smb: smbdirect: introduce smbdirect_init_send_batch_storage() This makes it possible to use batching via public functions without exposing the internals of struct smbdirect_send_batch. Once the client no longer needs to use smbdirect_connection_send_single_iter() we can remove this again. Cc: Steve French Cc: Tom Talpey Cc: Long Li Cc: Namjae Jeon Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher Acked-by: Namjae Jeon Signed-off-by: Steve French --- diff --git a/fs/smb/common/smbdirect/smbdirect_connection.c b/fs/smb/common/smbdirect/smbdirect_connection.c index 38fb0f34dc862..b7adbd04eb695 100644 --- a/fs/smb/common/smbdirect/smbdirect_connection.c +++ b/fs/smb/common/smbdirect/smbdirect_connection.c @@ -910,9 +910,10 @@ static void smbdirect_connection_send_batch_init(struct smbdirect_send_batch *ba batch->credit = 0; } -static int smbdirect_connection_send_batch_flush(struct smbdirect_socket *sc, - struct smbdirect_send_batch *batch, - bool is_last) +__SMBDIRECT_PUBLIC__ +int smbdirect_connection_send_batch_flush(struct smbdirect_socket *sc, + struct smbdirect_send_batch *batch, + bool is_last) { struct smbdirect_send_io *first, *last; int ret = 0; @@ -969,6 +970,26 @@ release_credit: return ret; } +__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connection_send_batch_flush); + +__SMBDIRECT_PUBLIC__ +struct smbdirect_send_batch * +smbdirect_init_send_batch_storage(struct smbdirect_send_batch_storage *storage, + bool need_invalidate_rkey, + unsigned int remote_key) +{ + struct smbdirect_send_batch *batch = (struct smbdirect_send_batch *)storage; + + memset(storage, 0, sizeof(*storage)); + BUILD_BUG_ON(sizeof(*batch) > sizeof(*storage)); + + smbdirect_connection_send_batch_init(batch, + need_invalidate_rkey, + remote_key); + + return batch; +} +__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_init_send_batch_storage); static int smbdirect_connection_wait_for_send_bcredit(struct smbdirect_socket *sc, struct smbdirect_send_batch *batch) diff --git a/fs/smb/common/smbdirect/smbdirect_public.h b/fs/smb/common/smbdirect/smbdirect_public.h index a5b15fce840cd..3d20d9a87e7ba 100644 --- a/fs/smb/common/smbdirect/smbdirect_public.h +++ b/fs/smb/common/smbdirect/smbdirect_public.h @@ -91,6 +91,29 @@ void smbdirect_socket_shutdown(struct smbdirect_socket *sc); __SMBDIRECT_PUBLIC__ void smbdirect_socket_release(struct smbdirect_socket *sc); +__SMBDIRECT_PUBLIC__ +int smbdirect_connection_send_batch_flush(struct smbdirect_socket *sc, + struct smbdirect_send_batch *batch, + bool is_last); + +/* + * This is only temporary and only needed + * as long as the client still requires + * to use smbdirect_connection_send_single_iter() + */ +struct smbdirect_send_batch_storage { + union { + struct list_head __msg_list; + __aligned_u64 __space[5]; + }; +}; + +__SMBDIRECT_PUBLIC__ +struct smbdirect_send_batch * +smbdirect_init_send_batch_storage(struct smbdirect_send_batch_storage *storage, + bool need_invalidate_rkey, + unsigned int remote_key); + __SMBDIRECT_PUBLIC__ int smbdirect_connection_send_single_iter(struct smbdirect_socket *sc, struct smbdirect_send_batch *batch,