[PATCH v2 044/127] smb: smbdirect: introduce smbdirect_mr_io_fill_buffer_descriptor()
Stefan Metzmacher
metze at samba.org
Wed Oct 29 13:20:22 UTC 2025
This will be used by the client instead of dereferencing
struct smbdirect_mr_io internals.
Cc: Steve French <smfrench at gmail.com>
Cc: Tom Talpey <tom at talpey.com>
Cc: Long Li <longli at microsoft.com>
Cc: Namjae Jeon <linkinjeon at kernel.org>
Cc: linux-cifs at vger.kernel.org
Cc: samba-technical at lists.samba.org
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
fs/smb/common/smbdirect/smbdirect_mr.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/fs/smb/common/smbdirect/smbdirect_mr.c b/fs/smb/common/smbdirect/smbdirect_mr.c
index 5fd6a853e656..bca58eee783b 100644
--- a/fs/smb/common/smbdirect/smbdirect_mr.c
+++ b/fs/smb/common/smbdirect/smbdirect_mr.c
@@ -453,6 +453,24 @@ smbdirect_connection_register_mr_io(struct smbdirect_socket *sc,
mutex_unlock(&mr->mutex);
return NULL;
}
+
+__maybe_unused /* this is temporary while this file is included in orders */
+static void smbdirect_mr_io_fill_buffer_descriptor(struct smbdirect_mr_io *mr,
+ struct smbdirect_buffer_descriptor_v1 *v1)
+{
+ mutex_lock(&mr->mutex);
+ if (mr->state == SMBDIRECT_MR_REGISTERED) {
+ v1->offset = cpu_to_le64(mr->mr->iova);
+ v1->token = cpu_to_le32(mr->mr->rkey);
+ v1->length = cpu_to_le32(mr->mr->length);
+ } else {
+ v1->offset = cpu_to_le64(U64_MAX);
+ v1->token = cpu_to_le32(U32_MAX);
+ v1->length = cpu_to_le32(U32_MAX);
+ }
+ mutex_unlock(&mr->mutex);
+}
+
/*
* Deregister a MR after I/O is done
* This function may wait if remote invalidation is not used
--
2.43.0
More information about the samba-technical
mailing list