fs/erofs/internal.h
Source file repositories/reference/linux-study-clean/fs/erofs/internal.h
File Facts
- System
- Linux kernel
- Corpus path
fs/erofs/internal.h- Extension
.h- Size
- 19052 bytes
- Lines
- 602
- 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/fs.hlinux/dax.hlinux/dcache.hlinux/mm.hlinux/module.hlinux/pagemap.hlinux/bio.hlinux/magic.hlinux/slab.hlinux/vmalloc.hlinux/iomap.herofs_fs.h
Detected Declarations
struct erofs_device_infostruct erofs_mount_optsstruct erofs_dev_contextstruct erofs_sb_lz4_infostruct erofs_domainstruct erofs_fscachestruct erofs_xattr_prefix_itemstruct erofs_sb_infostruct erofs_bufstruct erofs_inode_fingerprintstruct erofs_inodestruct erofs_map_blocksstruct erofs_map_devfunction erofs_is_fileio_modefunction erofs_is_fscache_modefunction erofs_nid_to_ino64function erofs_inode_in_metaboxfunction erofs_ilocfunction erofs_inode_versionfunction erofs_inode_datalayoutfunction erofs_get_aopsfunction erofs_pagepool_addfunction erofs_shrinker_registerfunction erofs_exit_shrinkerfunction z_erofs_exit_subsystemfunction erofs_fileio_submit_biofunction erofs_fscache_register_fsfunction erofs_fscache_unregister_fsfunction erofs_fscache_unregister_cookiefunction erofs_fscache_submit_biofunction erofs_init_isharefunction erofs_exit_isharefunction erofs_ishare_free_inode
Annotated Snippet
extern const struct file_operations erofs_file_fops;
extern const struct file_operations erofs_dir_fops;
extern const struct file_operations erofs_ishare_fops;
extern const struct iomap_ops z_erofs_iomap_report_ops;
/* flags for erofs_fscache_register_cookie() */
#define EROFS_REG_COOKIE_SHARE 0x0001
#define EROFS_REG_COOKIE_NEED_NOEXIST 0x0002
void *erofs_read_metadata(struct super_block *sb, struct erofs_buf *buf,
erofs_off_t *offset, int *lengthp);
void erofs_unmap_metabuf(struct erofs_buf *buf);
void erofs_put_metabuf(struct erofs_buf *buf);
void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset, bool need_kmap);
int erofs_init_metabuf(struct erofs_buf *buf, struct super_block *sb,
bool in_metabox);
void *erofs_read_metabuf(struct erofs_buf *buf, struct super_block *sb,
erofs_off_t offset, bool in_metabox);
int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *dev);
int erofs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
u64 start, u64 len);
int erofs_map_blocks(struct inode *inode, struct erofs_map_blocks *map);
void erofs_onlinefolio_init(struct folio *folio);
void erofs_onlinefolio_split(struct folio *folio);
void erofs_onlinefolio_end(struct folio *folio, int err, bool dirty);
struct inode *erofs_iget(struct super_block *sb, erofs_nid_t nid);
int erofs_getattr(struct mnt_idmap *idmap, const struct path *path,
struct kstat *stat, u32 request_mask,
unsigned int query_flags);
int erofs_namei(struct inode *dir, const struct qstr *name,
erofs_nid_t *nid, unsigned int *d_type);
static inline void *erofs_vm_map_ram(struct page **pages, unsigned int count)
{
int retried = 0;
while (1) {
void *p = vm_map_ram(pages, count, -1);
/* retry two more times (totally 3 times) */
if (p || ++retried >= 3)
return p;
vm_unmap_aliases();
}
return NULL;
}
static inline const struct address_space_operations *
erofs_get_aops(struct inode *realinode, bool no_fscache)
{
if (erofs_inode_is_data_compressed(EROFS_I(realinode)->datalayout)) {
if (!IS_ENABLED(CONFIG_EROFS_FS_ZIP))
return ERR_PTR(-EOPNOTSUPP);
DO_ONCE_LITE_IF(realinode->i_blkbits != PAGE_SHIFT,
erofs_info, realinode->i_sb,
"EXPERIMENTAL EROFS subpage compressed block support in use. Use at your own risk!");
return &z_erofs_aops;
}
if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && !no_fscache &&
erofs_is_fscache_mode(realinode->i_sb))
return &erofs_fscache_access_aops;
if (IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) &&
erofs_is_fileio_mode(EROFS_SB(realinode->i_sb)))
return &erofs_fileio_aops;
return &erofs_aops;
}
int erofs_register_sysfs(struct super_block *sb);
void erofs_unregister_sysfs(struct super_block *sb);
int __init erofs_init_sysfs(void);
void erofs_exit_sysfs(void);
struct page *__erofs_allocpage(struct page **pagepool, gfp_t gfp, bool tryrsv);
static inline struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp)
{
return __erofs_allocpage(pagepool, gfp, false);
}
static inline void erofs_pagepool_add(struct page **pagepool, struct page *page)
{
set_page_private(page, (unsigned long)*pagepool);
*pagepool = page;
}
void erofs_release_pages(struct page **pagepool);
#ifdef CONFIG_EROFS_FS_ZIP
#define MNGD_MAPPING(sbi) ((sbi)->managed_cache->i_mapping)
extern atomic_long_t erofs_global_shrink_cnt;
void erofs_shrinker_register(struct super_block *sb);
Annotation
- Immediate include surface: `linux/fs.h`, `linux/dax.h`, `linux/dcache.h`, `linux/mm.h`, `linux/module.h`, `linux/pagemap.h`, `linux/bio.h`, `linux/magic.h`.
- Detected declarations: `struct erofs_device_info`, `struct erofs_mount_opts`, `struct erofs_dev_context`, `struct erofs_sb_lz4_info`, `struct erofs_domain`, `struct erofs_fscache`, `struct erofs_xattr_prefix_item`, `struct erofs_sb_info`, `struct erofs_buf`, `struct erofs_inode_fingerprint`.
- 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.