block/fops.c
Source file repositories/reference/linux-study-clean/block/fops.c
File Facts
- System
- Linux kernel
- Corpus path
block/fops.c- Extension
.c- Size
- 24005 bytes
- Lines
- 954
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- 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/init.hlinux/mm.hlinux/blkdev.hlinux/blk-integrity.hlinux/buffer_head.hlinux/mpage.hlinux/uio.hlinux/namei.hlinux/task_io_accounting_ops.hlinux/falloc.hlinux/suspend.hlinux/fs.hlinux/iomap.hlinux/module.hlinux/io_uring/cmd.hblk.h
Detected Declarations
struct blkdev_diofunction Copyrightfunction dio_bio_write_opfunction blkdev_dio_invalidfunction blkdev_iov_iter_get_pagesfunction __blkdev_direct_IO_simplefunction blkdev_bio_end_iofunction __blkdev_direct_IOfunction blkdev_bio_end_io_asyncfunction __blkdev_direct_IO_asyncfunction blkdev_direct_IOfunction blkdev_iomap_beginfunction blkdev_get_blockfunction mpage_writepagesfunction blkdev_read_foliofunction blkdev_readaheadfunction blkdev_read_foliofunction blkdev_readaheadfunction blkdev_writeback_rangefunction blkdev_writepagesfunction file_inodefunction blkdev_fsyncfunction file_to_blk_modefunction blkdev_openfunction blkdev_releasefunction blkdev_direct_writefunction blkdev_buffered_writefunction blkdev_write_iterfunction blkdev_read_iterfunction blkdev_fallocatefunction blkdev_mmap_preparefunction blkdev_initmodule init blkdev_init
Annotated Snippet
const struct file_operations def_blk_fops = {
.open = blkdev_open,
.release = blkdev_release,
.llseek = blkdev_llseek,
.read_iter = blkdev_read_iter,
.write_iter = blkdev_write_iter,
.iopoll = iocb_bio_iopoll,
.mmap_prepare = blkdev_mmap_prepare,
.fsync = blkdev_fsync,
.unlocked_ioctl = blkdev_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = compat_blkdev_ioctl,
#endif
.splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write,
.fallocate = blkdev_fallocate,
.uring_cmd = blkdev_uring_cmd,
.fop_flags = FOP_BUFFER_RASYNC,
};
static __init int blkdev_init(void)
{
return bioset_init(&blkdev_dio_pool, 4,
offsetof(struct blkdev_dio, bio),
BIOSET_NEED_BVECS|BIOSET_PERCPU_CACHE);
}
module_init(blkdev_init);
Annotation
- Immediate include surface: `linux/init.h`, `linux/mm.h`, `linux/blkdev.h`, `linux/blk-integrity.h`, `linux/buffer_head.h`, `linux/mpage.h`, `linux/uio.h`, `linux/namei.h`.
- Detected declarations: `struct blkdev_dio`, `function Copyright`, `function dio_bio_write_op`, `function blkdev_dio_invalid`, `function blkdev_iov_iter_get_pages`, `function __blkdev_direct_IO_simple`, `function blkdev_bio_end_io`, `function __blkdev_direct_IO`, `function blkdev_bio_end_io_async`, `function __blkdev_direct_IO_async`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- 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.