fs/ocfs2/file.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/file.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/file.c- Extension
.c- Size
- 72956 bytes
- Lines
- 2899
- 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.
- 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
linux/capability.hlinux/fs.hlinux/types.hlinux/slab.hlinux/highmem.hlinux/pagemap.hlinux/uio.hlinux/sched.hlinux/splice.hlinux/mount.hlinux/writeback.hlinux/falloc.hlinux/filelock.hlinux/quotaops.hlinux/blkdev.hlinux/backing-dev.hcluster/masklog.hocfs2.halloc.haops.hdir.hdlmglue.hextent_map.hfile.hsysfile.hinode.hioctl.hjournal.hlocks.hmmap.hsuballoc.hsuper.h
Detected Declarations
function Copyrightfunction ocfs2_free_file_privatefunction ocfs2_file_openfunction ocfs2_file_releasefunction ocfs2_dir_openfunction ocfs2_dir_releasefunction ocfs2_sync_filefunction ocfs2_should_update_atimefunction ocfs2_update_inode_atimefunction ocfs2_set_inode_sizefunction ocfs2_simple_size_updatefunction ocfs2_cow_file_posfunction ocfs2_orphan_for_truncatefunction ocfs2_truncate_filefunction ocfs2_add_inode_datafunction ocfs2_extend_allocationfunction ocfs2_write_zero_pagefunction ocfs2_zero_extendfunction ocfs2_zero_extend_get_rangefunction ocfs2_zero_extendfunction ocfs2_extend_no_holesfunction ocfs2_extend_filefunction ocfs2_setattrfunction ocfs2_getattrfunction ocfs2_permissionfunction __ocfs2_write_remove_suidfunction ocfs2_write_remove_suidfunction ocfs2_allocate_unwritten_extentsfunction ocfs2_truncate_cluster_pagesfunction ocfs2_zeroout_partial_clusterfunction ocfs2_zero_partial_clustersfunction ocfs2_zero_range_for_truncatefunction ocfs2_find_recfunction ocfs2_calc_trunc_posfunction ocfs2_remove_inode_rangefunction clusterfunction xfs_change_file_spacefunction ocfs2_change_file_spacefunction ocfs2_fallocatefunction ocfs2_check_range_for_refcountfunction ocfs2_is_io_unalignedfunction ocfs2_inode_lock_for_extent_treefunction ocfs2_inode_unlock_for_extent_treefunction ocfs2_prepare_inode_for_writefunction remove_suidfunction ocfs2_file_write_iterfunction g_f_a_w_nfunction ocfs2_file_read_iter
Annotated Snippet
const struct file_operations ocfs2_fops = {
.llseek = ocfs2_file_llseek,
.mmap_prepare = ocfs2_mmap_prepare,
.fsync = ocfs2_sync_file,
.release = ocfs2_file_release,
.open = ocfs2_file_open,
.read_iter = ocfs2_file_read_iter,
.write_iter = ocfs2_file_write_iter,
.unlocked_ioctl = ocfs2_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ocfs2_compat_ioctl,
#endif
.lock = ocfs2_lock,
.flock = ocfs2_flock,
.splice_read = ocfs2_file_splice_read,
.splice_write = iter_file_splice_write,
.fallocate = ocfs2_fallocate,
.remap_file_range = ocfs2_remap_file_range,
.fop_flags = FOP_ASYNC_LOCK,
.setlease = generic_setlease,
};
WRAP_DIR_ITER(ocfs2_readdir) // FIXME!
const struct file_operations ocfs2_dops = {
.llseek = ocfs2_dir_llseek,
.read = generic_read_dir,
.iterate_shared = shared_ocfs2_readdir,
.fsync = ocfs2_sync_file,
.release = ocfs2_dir_release,
.open = ocfs2_dir_open,
.unlocked_ioctl = ocfs2_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ocfs2_compat_ioctl,
#endif
.lock = ocfs2_lock,
.flock = ocfs2_flock,
.fop_flags = FOP_ASYNC_LOCK,
.setlease = generic_setlease,
};
/*
* POSIX-lockless variants of our file_operations.
*
* These will be used if the underlying cluster stack does not support
* posix file locking, if the user passes the "localflocks" mount
* option, or if we have a local-only fs.
*
* ocfs2_flock is in here because all stacks handle UNIX file locks,
* so we still want it in the case of no stack support for
* plocks. Internally, it will do the right thing when asked to ignore
* the cluster.
*/
const struct file_operations ocfs2_fops_no_plocks = {
.llseek = ocfs2_file_llseek,
.mmap_prepare = ocfs2_mmap_prepare,
.fsync = ocfs2_sync_file,
.release = ocfs2_file_release,
.open = ocfs2_file_open,
.read_iter = ocfs2_file_read_iter,
.write_iter = ocfs2_file_write_iter,
.unlocked_ioctl = ocfs2_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ocfs2_compat_ioctl,
#endif
.flock = ocfs2_flock,
.splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write,
.fallocate = ocfs2_fallocate,
.remap_file_range = ocfs2_remap_file_range,
.setlease = generic_setlease,
};
const struct file_operations ocfs2_dops_no_plocks = {
.llseek = ocfs2_dir_llseek,
.read = generic_read_dir,
.iterate_shared = shared_ocfs2_readdir,
.fsync = ocfs2_sync_file,
.release = ocfs2_dir_release,
.open = ocfs2_dir_open,
.unlocked_ioctl = ocfs2_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ocfs2_compat_ioctl,
#endif
.flock = ocfs2_flock,
.setlease = generic_setlease,
};
Annotation
- Immediate include surface: `linux/capability.h`, `linux/fs.h`, `linux/types.h`, `linux/slab.h`, `linux/highmem.h`, `linux/pagemap.h`, `linux/uio.h`, `linux/sched.h`.
- Detected declarations: `function Copyright`, `function ocfs2_free_file_private`, `function ocfs2_file_open`, `function ocfs2_file_release`, `function ocfs2_dir_open`, `function ocfs2_dir_release`, `function ocfs2_sync_file`, `function ocfs2_should_update_atime`, `function ocfs2_update_inode_atime`, `function ocfs2_set_inode_size`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: pattern implementation candidate.
- 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.