From: Stefan Metzmacher Date: Tue, 21 Oct 2025 18:43:44 +0000 (+0200) Subject: smb: client: introduce and use smbd_mr_fill_buffer_descriptor() X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=5bd752e7749e4abcae71d95e22b75272ac767b06;p=thirdparty%2Fkernel%2Flinux.git smb: client: introduce and use smbd_mr_fill_buffer_descriptor() This will allow us to make struct smbdirect_mr_io private in future. 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/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 59d7418cc4806..0aeb23aed8eb7 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4554,9 +4554,7 @@ smb2_new_read_req(void **buf, unsigned int *total_len, req->ReadChannelInfoLength = cpu_to_le16(sizeof(struct smbdirect_buffer_descriptor_v1)); v1 = (struct smbdirect_buffer_descriptor_v1 *) &req->Buffer[0]; - v1->offset = cpu_to_le64(rdata->mr->mr->iova); - v1->token = cpu_to_le32(rdata->mr->mr->rkey); - v1->length = cpu_to_le32(rdata->mr->mr->length); + smbd_mr_fill_buffer_descriptor(rdata->mr, v1); *total_len += sizeof(*v1) - 1; } @@ -5155,9 +5153,7 @@ smb2_async_writev(struct cifs_io_subrequest *wdata) req->WriteChannelInfoLength = cpu_to_le16(sizeof(struct smbdirect_buffer_descriptor_v1)); v1 = (struct smbdirect_buffer_descriptor_v1 *) &req->Buffer[0]; - v1->offset = cpu_to_le64(wdata->mr->mr->iova); - v1->token = cpu_to_le32(wdata->mr->mr->rkey); - v1->length = cpu_to_le32(wdata->mr->mr->length); + smbd_mr_fill_buffer_descriptor(wdata->mr, v1); rqst.rq_iov[0].iov_len += sizeof(*v1); diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c index ee3347289c873..93a91d4e0da59 100644 --- a/fs/smb/client/smbdirect.c +++ b/fs/smb/client/smbdirect.c @@ -1294,6 +1294,12 @@ struct smbdirect_mr_io *smbd_register_mr(struct smbd_connection *info, return smbdirect_connection_register_mr_io(sc, iter, writing, need_invalidate); } +void smbd_mr_fill_buffer_descriptor(struct smbdirect_mr_io *mr, + struct smbdirect_buffer_descriptor_v1 *v1) +{ + smbdirect_mr_io_fill_buffer_descriptor(mr, v1); +} + /* * Deregister a MR after I/O is done * This function may wait if remote invalidation is not used diff --git a/fs/smb/client/smbdirect.h b/fs/smb/client/smbdirect.h index 577d37dbeb8a3..09f7dd14b2c10 100644 --- a/fs/smb/client/smbdirect.h +++ b/fs/smb/client/smbdirect.h @@ -60,6 +60,8 @@ int smbd_send(struct TCP_Server_Info *server, struct smbdirect_mr_io *smbd_register_mr( struct smbd_connection *info, struct iov_iter *iter, bool writing, bool need_invalidate); +void smbd_mr_fill_buffer_descriptor(struct smbdirect_mr_io *mr, + struct smbdirect_buffer_descriptor_v1 *v1); void smbd_deregister_mr(struct smbdirect_mr_io *mr); #else