include/linux/fs.h
Source file repositories/reference/linux-study-clean/include/linux/fs.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/fs.h- Extension
.h- Size
- 121836 bytes
- Lines
- 3670
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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/fs/super.hlinux/vfsdebug.hlinux/linkage.hlinux/wait_bit.hlinux/kdev_t.hlinux/dcache.hlinux/path.hlinux/stat.hlinux/cache.hlinux/list.hlinux/llist.hlinux/radix-tree.hlinux/xarray.hlinux/rbtree.hlinux/init.hlinux/pid.hlinux/bug.hlinux/mutex.hlinux/rwsem.hlinux/mm_types.hlinux/capability.hlinux/semaphore.hlinux/fcntl.hlinux/rculist_bl.hlinux/atomic.hlinux/shrinker.hlinux/migrate_mode.hlinux/uidgid.hlinux/lockdep.hlinux/percpu-rwsem.hlinux/workqueue.hlinux/delayed_call.h
Detected Declarations
struct bdi_writebackstruct biostruct io_comp_batchstruct fiemap_extent_infostruct kiocbstruct kobjectstruct pipe_inode_infostruct poll_table_structstruct kstatfsstruct vm_area_structstruct vfsmountstruct credstruct swap_info_structstruct seq_filestruct iov_iterstruct fsnotify_mark_connectorstruct fs_contextstruct fs_parameter_specstruct file_kattrstruct iomap_opsstruct delegated_inodestruct buffer_headstruct iattrstruct pagestruct address_spacestruct writeback_controlstruct readahead_controlstruct kiocbstruct address_space_operationsstruct mapping_metadata_bhsstruct address_spacestruct posix_aclstruct inode_state_flagsstruct inodestruct fown_structstruct file_ra_statestruct filestruct file_handlestruct file_lockstruct file_leasestruct fasync_structstruct renamedatastruct dir_contextstruct dir_contextstruct io_uring_cmdstruct offset_ctxstruct file_operationsstruct inode_operations
Annotated Snippet
const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
void (*free_inode)(struct inode *);
};
struct file_lock_context *i_flctx;
struct address_space i_data;
union {
struct list_head i_devices;
int i_linklen;
};
union {
struct pipe_inode_info *i_pipe;
struct cdev *i_cdev;
char *i_link;
unsigned i_dir_seq;
};
#ifdef CONFIG_FSNOTIFY
__u32 i_fsnotify_mask; /* all events this inode cares about */
/* 32-bit hole reserved for expanding i_fsnotify_mask */
struct fsnotify_mark_connector __rcu *i_fsnotify_marks;
#endif
void *i_private; /* fs or device private pointer */
} __randomize_layout;
/*
* i_state handling
*
* We hide all of it behind helpers so that we can validate consumers.
*/
static inline enum inode_state_flags_enum inode_state_read_once(struct inode *inode)
{
return READ_ONCE(inode->i_state.__state);
}
static inline enum inode_state_flags_enum inode_state_read(struct inode *inode)
{
lockdep_assert_held(&inode->i_lock);
return inode->i_state.__state;
}
static inline void inode_state_set_raw(struct inode *inode,
enum inode_state_flags_enum flags)
{
WRITE_ONCE(inode->i_state.__state, inode->i_state.__state | flags);
}
static inline void inode_state_set(struct inode *inode,
enum inode_state_flags_enum flags)
{
lockdep_assert_held(&inode->i_lock);
inode_state_set_raw(inode, flags);
}
static inline void inode_state_clear_raw(struct inode *inode,
enum inode_state_flags_enum flags)
{
WRITE_ONCE(inode->i_state.__state, inode->i_state.__state & ~flags);
}
static inline void inode_state_clear(struct inode *inode,
enum inode_state_flags_enum flags)
{
lockdep_assert_held(&inode->i_lock);
inode_state_clear_raw(inode, flags);
}
static inline void inode_state_assign_raw(struct inode *inode,
enum inode_state_flags_enum flags)
{
WRITE_ONCE(inode->i_state.__state, flags);
}
static inline void inode_state_assign(struct inode *inode,
enum inode_state_flags_enum flags)
{
lockdep_assert_held(&inode->i_lock);
inode_state_assign_raw(inode, flags);
}
static inline void inode_state_replace_raw(struct inode *inode,
enum inode_state_flags_enum clearflags,
enum inode_state_flags_enum setflags)
{
enum inode_state_flags_enum flags;
flags = inode->i_state.__state;
flags &= ~clearflags;
flags |= setflags;
inode_state_assign_raw(inode, flags);
Annotation
- Immediate include surface: `linux/fs/super.h`, `linux/vfsdebug.h`, `linux/linkage.h`, `linux/wait_bit.h`, `linux/kdev_t.h`, `linux/dcache.h`, `linux/path.h`, `linux/stat.h`.
- Detected declarations: `struct bdi_writeback`, `struct bio`, `struct io_comp_batch`, `struct fiemap_extent_info`, `struct kiocb`, `struct kobject`, `struct pipe_inode_info`, `struct poll_table_struct`, `struct kstatfs`, `struct vm_area_struct`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.