fs/fuse/file.c
Source file repositories/reference/linux-study-clean/fs/fuse/file.c
File Facts
- System
- Linux kernel
- Corpus path
fs/fuse/file.c- Extension
.c- Size
- 80449 bytes
- Lines
- 3143
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
fuse_i.hdev.hlinux/pagemap.hlinux/slab.hlinux/kernel.hlinux/sched.hlinux/sched/signal.hlinux/module.hlinux/swap.hlinux/falloc.hlinux/uio.hlinux/fs.hlinux/filelock.hlinux/splice.hlinux/task_io_accounting_ops.hlinux/iomap.h
Detected Declarations
struct fuse_writepage_argsstruct fuse_fill_read_datastruct fuse_fill_wb_datafunction Copyrightfunction fuse_file_freefunction fuse_release_endfunction fuse_file_putfunction fuse_do_openfunction fuse_link_write_filefunction fuse_finish_openfunction fuse_truncate_update_attrfunction fuse_openfunction fuse_prepare_releasefunction fuse_file_releasefunction fuse_release_commonfunction fuse_releasefunction fuse_sync_releasefunction fuse_lock_owner_idfunction fuse_sync_writesfunction fuse_flushfunction fuse_fsync_commonfunction fuse_fsyncfunction fuse_read_args_fillfunction fuse_release_user_pagesfunction fuse_io_releasefunction fuse_get_res_by_iofunction fuse_aio_invalidate_workerfunction completedfunction fuse_io_freefunction fuse_aio_complete_reqfunction fuse_async_req_sendfunction fuse_send_readfunction fuse_read_update_sizefunction fuse_short_readfunction fuse_do_readfoliofunction fuse_iomap_beginfunction fuse_handle_readaheadfunction fuse_iomap_read_folio_range_asyncfunction fuse_iomap_submit_readfunction fuse_read_foliofunction fuse_iomap_read_folio_rangefunction fuse_readpages_endfunction fuse_send_readpagesfunction fuse_readaheadfunction fuse_cache_read_iterfunction fuse_write_args_fillfunction fuse_write_flagsfunction fuse_send_write
Annotated Snippet
static const struct file_operations fuse_file_operations = {
.llseek = fuse_file_llseek,
.read_iter = fuse_file_read_iter,
.write_iter = fuse_file_write_iter,
.mmap = fuse_file_mmap,
.open = fuse_open,
.flush = fuse_flush,
.release = fuse_release,
.fsync = fuse_fsync,
.lock = fuse_file_lock,
.get_unmapped_area = thp_get_unmapped_area,
.flock = fuse_file_flock,
.splice_read = fuse_splice_read,
.splice_write = fuse_splice_write,
.unlocked_ioctl = fuse_file_ioctl,
.compat_ioctl = fuse_file_compat_ioctl,
.poll = fuse_file_poll,
.fallocate = fuse_file_fallocate,
.copy_file_range = fuse_copy_file_range,
.setlease = generic_setlease,
};
static const struct address_space_operations fuse_file_aops = {
.read_folio = fuse_read_folio,
.readahead = fuse_readahead,
.writepages = fuse_writepages,
.launder_folio = fuse_launder_folio,
.dirty_folio = iomap_dirty_folio,
.release_folio = iomap_release_folio,
.invalidate_folio = iomap_invalidate_folio,
.is_partially_uptodate = iomap_is_partially_uptodate,
.migrate_folio = filemap_migrate_folio,
.bmap = fuse_bmap,
.direct_IO = fuse_direct_IO,
};
void fuse_init_file_inode(struct inode *inode, unsigned int flags)
{
struct fuse_inode *fi = get_fuse_inode(inode);
struct fuse_conn *fc = get_fuse_conn(inode);
inode->i_fop = &fuse_file_operations;
inode->i_data.a_ops = &fuse_file_aops;
if (fc->writeback_cache)
mapping_set_writeback_may_deadlock_on_reclaim(&inode->i_data);
INIT_LIST_HEAD(&fi->write_files);
INIT_LIST_HEAD(&fi->queued_writes);
fi->writectr = 0;
fi->iocachectr = 0;
init_waitqueue_head(&fi->page_waitq);
init_waitqueue_head(&fi->direct_io_waitq);
if (IS_ENABLED(CONFIG_FUSE_DAX))
fuse_dax_inode_init(inode, flags);
}
Annotation
- Immediate include surface: `fuse_i.h`, `dev.h`, `linux/pagemap.h`, `linux/slab.h`, `linux/kernel.h`, `linux/sched.h`, `linux/sched/signal.h`, `linux/module.h`.
- Detected declarations: `struct fuse_writepage_args`, `struct fuse_fill_read_data`, `struct fuse_fill_wb_data`, `function Copyright`, `function fuse_file_free`, `function fuse_release_end`, `function fuse_file_put`, `function fuse_do_open`, `function fuse_link_write_file`, `function fuse_finish_open`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: pattern 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.