fs/fuse/dev_uring.c
Source file repositories/reference/linux-study-clean/fs/fuse/dev_uring.c
File Facts
- System
- Linux kernel
- Corpus path
fs/fuse/dev_uring.c- Extension
.c- Size
- 35776 bytes
- Lines
- 1457
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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
dev.hargs.hdev_uring_i.hfuse_trace.hlinux/fs.hlinux/io_uring/cmd.h
Detected Declarations
struct fuse_uring_pduenum fuse_uring_header_typefunction fuse_uring_enabledfunction uring_cmd_set_ring_entfunction fuse_uring_flush_bgfunction fuse_uring_req_endfunction fuse_uring_abort_end_queue_requestsfunction fuse_uring_abort_end_requestsfunction ent_list_request_expiredfunction fuse_uring_request_expiredfunction fuse_uring_destructfunction list_for_each_entry_safefunction fuse_uring_stop_fuse_req_endfunction fuse_uring_entry_teardownfunction fuse_uring_stop_list_entriesfunction fuse_uring_teardown_entriesfunction fuse_uring_teardown_all_queuesfunction fuse_uring_log_ent_statefunction list_for_each_entryfunction list_for_each_entryfunction fuse_uring_async_stop_queuesfunction fuse_uring_stop_queuesfunction fuse_dev_releasefunction fuse_uring_prepare_cancelfunction fuse_uring_out_header_has_errfunction ring_header_type_offsetfunction copy_header_to_ringfunction copy_header_from_ringfunction setup_fuse_copy_statefunction fuse_uring_copy_from_ringfunction fuse_uring_args_to_ringfunction fuse_uring_copy_to_ringfunction fuse_uring_prepare_sendfunction fuse_uring_add_to_pqfunction fuse_uring_ent_availfunction fuse_uring_add_req_to_ring_entfunction writefunction fuse_uring_get_next_fuse_reqfunction fuse_ring_ent_set_commitfunction fuse_uring_sendfunction fuse_uring_commit_fetchfunction is_ring_readyfunction fuse_uring_do_registerfunction fuse_uring_get_iovec_from_sqefunction fuse_uring_create_ring_entfunction fuse_uring_registerfunction fuse_uring_cmdfunction fuse_uring_send_in_task
Annotated Snippet
struct fuse_uring_pdu {
struct fuse_ring_ent *ent;
};
static const struct fuse_iqueue_ops fuse_io_uring_ops;
enum fuse_uring_header_type {
/* struct fuse_in_header / struct fuse_out_header */
FUSE_URING_HEADER_IN_OUT,
/* per op code header */
FUSE_URING_HEADER_OP,
/* struct fuse_uring_ent_in_out header */
FUSE_URING_HEADER_RING_ENT,
};
static void uring_cmd_set_ring_ent(struct io_uring_cmd *cmd,
struct fuse_ring_ent *ring_ent)
{
struct fuse_uring_pdu *pdu =
io_uring_cmd_to_pdu(cmd, struct fuse_uring_pdu);
pdu->ent = ring_ent;
}
static struct fuse_ring_ent *uring_cmd_to_ring_ent(struct io_uring_cmd *cmd)
{
struct fuse_uring_pdu *pdu =
io_uring_cmd_to_pdu(cmd, struct fuse_uring_pdu);
return pdu->ent;
}
static void fuse_uring_flush_bg(struct fuse_ring_queue *queue)
{
struct fuse_ring *ring = queue->ring;
struct fuse_chan *fch = ring->chan;
lockdep_assert_held(&queue->lock);
lockdep_assert_held(&fch->bg_lock);
/*
* Allow one bg request per queue, ignoring global fc limits.
* This prevents a single queue from consuming all resources and
* eliminates the need for remote queue wake-ups when global
* limits are met but this queue has no more waiting requests.
*/
while ((fch->active_background < fch->max_background ||
!queue->active_background) &&
(!list_empty(&queue->fuse_req_bg_queue))) {
struct fuse_req *req;
req = list_first_entry(&queue->fuse_req_bg_queue,
struct fuse_req, list);
fch->active_background++;
queue->active_background++;
list_move_tail(&req->list, &queue->fuse_req_queue);
}
}
static void fuse_uring_req_end(struct fuse_ring_ent *ent, struct fuse_req *req,
int error)
{
struct fuse_ring_queue *queue = ent->queue;
struct fuse_ring *ring = queue->ring;
struct fuse_chan *fch = ring->chan;
lockdep_assert_not_held(&queue->lock);
spin_lock(&queue->lock);
ent->fuse_req = NULL;
list_del_init(&req->list);
if (test_bit(FR_BACKGROUND, &req->flags)) {
queue->active_background--;
spin_lock(&fch->bg_lock);
fuse_request_bg_finish(fch, req);
fuse_uring_flush_bg(queue);
spin_unlock(&fch->bg_lock);
}
spin_unlock(&queue->lock);
if (error)
req->out.h.error = error;
clear_bit(FR_SENT, &req->flags);
fuse_request_end(req);
}
/* Abort all list queued request on the given ring queue */
static void fuse_uring_abort_end_queue_requests(struct fuse_ring_queue *queue)
Annotation
- Immediate include surface: `dev.h`, `args.h`, `dev_uring_i.h`, `fuse_trace.h`, `linux/fs.h`, `linux/io_uring/cmd.h`.
- Detected declarations: `struct fuse_uring_pdu`, `enum fuse_uring_header_type`, `function fuse_uring_enabled`, `function uring_cmd_set_ring_ent`, `function fuse_uring_flush_bg`, `function fuse_uring_req_end`, `function fuse_uring_abort_end_queue_requests`, `function fuse_uring_abort_end_requests`, `function ent_list_request_expired`, `function fuse_uring_request_expired`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.