fs/gfs2/file.c
Source file repositories/reference/linux-study-clean/fs/gfs2/file.c
File Facts
- System
- Linux kernel
- Corpus path
fs/gfs2/file.c- Extension
.c- Size
- 41739 bytes
- Lines
- 1643
- 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
linux/slab.hlinux/spinlock.hlinux/compat.hlinux/completion.hlinux/buffer_head.hlinux/pagemap.hlinux/uio.hlinux/blkdev.hlinux/mm.hlinux/mount.hlinux/fs.hlinux/filelock.hlinux/gfs2_ondisk.hlinux/falloc.hlinux/swap.hlinux/crc32.hlinux/writeback.hlinux/uaccess.hlinux/dlm.hlinux/dlm_plock.hlinux/delay.hlinux/backing-dev.hlinux/fileattr.hgfs2.hincore.hbmap.haops.hdir.hglock.hglops.hinode.hlog.h
Detected Declarations
function Copyrightfunction gfs2_readdirfunction gfs2_gfsflags_to_fsflagsfunction gfs2_fileattr_getfunction gfs2_set_inode_flagsfunction do_gfs2_set_flagsfunction gfs2_fileattr_setfunction gfs2_getlabelfunction gfs2_ioctlfunction gfs2_compat_ioctlfunction gfs2_size_hintfunction gfs2_allocate_folio_backingfunction gfs2_page_mkwritefunction gfs2_faultfunction updatefunction gfs2_open_commonfunction gfs2_openfunction gfs2_releasefunction gfs2_fsyncfunction should_fault_in_pagesfunction gfs2_file_direct_readfunction gfs2_file_direct_writefunction gfs2_file_read_iterfunction gfs2_file_buffered_writefunction gfs2_file_write_iterfunction fallocate_chunkfunction calc_max_reservfunction __gfs2_fallocatefunction gfs2_fallocatefunction gfs2_file_splice_writefunction gfs2_lockfunction __flock_holder_uninitfunction do_flockfunction do_unflockfunction gfs2_flock
Annotated Snippet
const struct file_operations gfs2_file_fops = {
.llseek = gfs2_llseek,
.read_iter = gfs2_file_read_iter,
.write_iter = gfs2_file_write_iter,
.iopoll = iocb_bio_iopoll,
.unlocked_ioctl = gfs2_ioctl,
.compat_ioctl = gfs2_compat_ioctl,
.mmap = gfs2_mmap,
.open = gfs2_open,
.release = gfs2_release,
.fsync = gfs2_fsync,
.lock = gfs2_lock,
.flock = gfs2_flock,
.splice_read = copy_splice_read,
.splice_write = gfs2_file_splice_write,
.fallocate = gfs2_fallocate,
.fop_flags = FOP_ASYNC_LOCK,
};
const struct file_operations gfs2_dir_fops = {
.iterate_shared = gfs2_readdir,
.unlocked_ioctl = gfs2_ioctl,
.compat_ioctl = gfs2_compat_ioctl,
.open = gfs2_open,
.release = gfs2_release,
.fsync = gfs2_fsync,
.lock = gfs2_lock,
.flock = gfs2_flock,
.llseek = default_llseek,
.fop_flags = FOP_ASYNC_LOCK,
};
#endif /* CONFIG_GFS2_FS_LOCKING_DLM */
const struct file_operations gfs2_file_fops_nolock = {
.llseek = gfs2_llseek,
.read_iter = gfs2_file_read_iter,
.write_iter = gfs2_file_write_iter,
.iopoll = iocb_bio_iopoll,
.unlocked_ioctl = gfs2_ioctl,
.compat_ioctl = gfs2_compat_ioctl,
.mmap = gfs2_mmap,
.open = gfs2_open,
.release = gfs2_release,
.fsync = gfs2_fsync,
.splice_read = copy_splice_read,
.splice_write = gfs2_file_splice_write,
.setlease = generic_setlease,
.fallocate = gfs2_fallocate,
};
const struct file_operations gfs2_dir_fops_nolock = {
.iterate_shared = gfs2_readdir,
.unlocked_ioctl = gfs2_ioctl,
.compat_ioctl = gfs2_compat_ioctl,
.open = gfs2_open,
.release = gfs2_release,
.fsync = gfs2_fsync,
.llseek = default_llseek,
.setlease = generic_setlease,
};
Annotation
- Immediate include surface: `linux/slab.h`, `linux/spinlock.h`, `linux/compat.h`, `linux/completion.h`, `linux/buffer_head.h`, `linux/pagemap.h`, `linux/uio.h`, `linux/blkdev.h`.
- Detected declarations: `function Copyright`, `function gfs2_readdir`, `function gfs2_gfsflags_to_fsflags`, `function gfs2_fileattr_get`, `function gfs2_set_inode_flags`, `function do_gfs2_set_flags`, `function gfs2_fileattr_set`, `function gfs2_getlabel`, `function gfs2_ioctl`, `function gfs2_compat_ioctl`.
- 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.