fs/smb/client/smbdirect.c
Source file repositories/reference/linux-study-clean/fs/smb/client/smbdirect.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/smbdirect.c- Extension
.c- Size
- 16228 bytes
- Lines
- 562
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
smbdirect.hcifs_debug.hcifsproto.hsmb2proto.h
Detected Declarations
function smbd_logging_neededfunction smbd_logging_vaprintffunction log_rdmafunction smbdirect_connection_send_single_iterfunction smbd_destroyfunction smbd_reconnectfunction smbd_recvfunction smbd_sendfunction smbd_mr_fill_buffer_descriptorfunction smbd_deregister_mrfunction smbd_debug_proc_show
Annotated Snippet
if (rc < 0) {
error = rc;
break;
}
remaining_data_length -= rc;
if (iov_iter_count(&rqst->rq_iter) > 0) {
/* And then the data pages if there are any */
rc = smbd_post_send_full_iter(sc, batch, &rqst->rq_iter,
remaining_data_length);
if (rc < 0) {
error = rc;
break;
}
remaining_data_length -= rc;
}
} while (++rqst_idx < num_rqst);
rc = smbdirect_connection_send_batch_flush(sc, batch, true);
if (unlikely(!rc && error))
rc = error;
/*
* As an optimization, we don't wait for individual I/O to finish
* before sending the next one.
* Send them all and wait for pending send count to get to 0
* that means all the I/Os have been out and we are good to return
*/
error = rc;
rc = smbdirect_connection_send_wait_zero_pending(sc);
if (unlikely(rc && !error))
error = -EAGAIN;
if (unlikely(error))
return error;
return 0;
}
/*
* Register memory for RDMA read/write
* iter: the buffer to register memory with
* writing: true if this is a RDMA write (SMB read), false for RDMA read
* need_invalidate: true if this MR needs to be locally invalidated after I/O
* return value: the MR registered, NULL if failed.
*/
struct smbdirect_mr_io *smbd_register_mr(struct smbd_connection *info,
struct iov_iter *iter,
bool writing, bool need_invalidate)
{
struct smbdirect_socket *sc = info->socket;
if (!smbdirect_connection_is_connected(sc))
return NULL;
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
* and we have to locally invalidate the buffer to prevent data is being
* modified by remote peer after upper layer consumes it
*/
void smbd_deregister_mr(struct smbdirect_mr_io *mr)
{
smbdirect_connection_deregister_mr_io(mr);
}
void smbd_debug_proc_show(struct TCP_Server_Info *server, struct seq_file *m)
{
if (!server->rdma)
return;
if (!server->smbd_conn) {
seq_puts(m, "\nSMBDirect transport not available");
return;
}
smbdirect_connection_legacy_debug_proc_show(server->smbd_conn->socket,
server->rdma_readwrite_threshold,
m);
Annotation
- Immediate include surface: `smbdirect.h`, `cifs_debug.h`, `cifsproto.h`, `smb2proto.h`.
- Detected declarations: `function smbd_logging_needed`, `function smbd_logging_vaprintf`, `function log_rdma`, `function smbdirect_connection_send_single_iter`, `function smbd_destroy`, `function smbd_reconnect`, `function smbd_recv`, `function smbd_send`, `function smbd_mr_fill_buffer_descriptor`, `function smbd_deregister_mr`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.