fs/ocfs2/super.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/super.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/super.c- Extension
.c- Size
- 69583 bytes
- Lines
- 2575
- 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/module.hlinux/fs.hlinux/types.hlinux/slab.hlinux/highmem.hlinux/init.hlinux/random.hlinux/statfs.hlinux/moduleparam.hlinux/blkdev.hlinux/socket.hlinux/inet.hlinux/fs_parser.hlinux/fs_context.hlinux/crc32.hlinux/debugfs.hlinux/seq_file.hlinux/quotaops.hlinux/signal.hocfs2_trace.hcluster/masklog.hocfs2.hocfs1_fs_compat.halloc.haops.hblockcheck.hdlmglue.hexport.hextent_map.hheartbeat.hinode.hjournal.h
Detected Declarations
struct mount_optionsfunction ocfs2_osb_dumpfunction ocfs2_osb_debug_openfunction ocfs2_debug_releasefunction ocfs2_debug_readfunction ocfs2_osb_debug_openfunction ocfs2_debug_releasefunction ocfs2_debug_readfunction ocfs2_sync_fsfunction ocfs2_need_system_inodefunction ocfs2_init_global_system_inodesfunction ocfs2_init_local_system_inodesfunction ocfs2_release_system_inodesfunction ocfs2_free_inodefunction ocfs2_max_file_offsetfunction ocfs2_reconfigurefunction ocfs2_sb_probefunction strlenfunction ocfs2_verify_heartbeatfunction ocfs2_verify_userspace_stackfunction ocfs2_susp_quotasfunction ocfs2_enable_quotasfunction ocfs2_disable_quotasfunction ocfs2_fill_superfunction ocfs2_get_treefunction ocfs2_free_fcfunction ocfs2_init_fs_contextfunction ocfs2_check_set_optionsfunction ocfs2_parse_paramfunction ocfs2_show_optionsfunction ocfs2_initfunction ocfs2_exitfunction ocfs2_put_superfunction ocfs2_statfsfunction ocfs2_inode_init_oncefunction ocfs2_initialize_mem_cachesfunction ocfs2_free_mem_cachesfunction ocfs2_get_sectorfunction ocfs2_mount_volumefunction ocfs2_dismount_volumefunction ocfs2_setup_osb_uuidfunction ocfs2_journal_initfunction jbd2_journal_check_used_featuresfunction ocfs2_initialize_superfunction ocfs2_verify_volumefunction le16_to_cpufunction le32_to_cpufunction ocfs2_check_volume
Annotated Snippet
static const struct file_operations ocfs2_osb_debug_fops = {
.open = ocfs2_osb_debug_open,
.release = ocfs2_debug_release,
.read = ocfs2_debug_read,
.llseek = generic_file_llseek,
};
static int ocfs2_sync_fs(struct super_block *sb, int wait)
{
int status;
tid_t target;
struct ocfs2_super *osb = OCFS2_SB(sb);
if (ocfs2_is_hard_readonly(osb))
return -EROFS;
if (wait) {
status = ocfs2_flush_truncate_log(osb);
if (status < 0)
mlog_errno(status);
} else {
ocfs2_schedule_truncate_log_flush(osb, 0);
}
if (jbd2_journal_start_commit(osb->journal->j_journal,
&target)) {
if (wait)
jbd2_log_wait_commit(osb->journal->j_journal,
target);
}
return 0;
}
static int ocfs2_need_system_inode(struct ocfs2_super *osb, int ino)
{
if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA)
&& (ino == USER_QUOTA_SYSTEM_INODE
|| ino == LOCAL_USER_QUOTA_SYSTEM_INODE))
return 0;
if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
&& (ino == GROUP_QUOTA_SYSTEM_INODE
|| ino == LOCAL_GROUP_QUOTA_SYSTEM_INODE))
return 0;
return 1;
}
static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
{
struct inode *new = NULL;
int status = 0;
int i;
new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE, 0);
if (IS_ERR(new)) {
status = PTR_ERR(new);
mlog_errno(status);
goto bail;
}
osb->root_inode = new;
new = ocfs2_iget(osb, osb->system_dir_blkno, OCFS2_FI_FLAG_SYSFILE, 0);
if (IS_ERR(new)) {
status = PTR_ERR(new);
mlog_errno(status);
goto bail;
}
osb->sys_root_inode = new;
for (i = OCFS2_FIRST_ONLINE_SYSTEM_INODE;
i <= OCFS2_LAST_GLOBAL_SYSTEM_INODE; i++) {
if (!ocfs2_need_system_inode(osb, i))
continue;
new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
if (!new) {
ocfs2_release_system_inodes(osb);
status = ocfs2_is_soft_readonly(osb) ? -EROFS : -EINVAL;
mlog_errno(status);
mlog(ML_ERROR, "Unable to load system inode %d, "
"possibly corrupt fs?", i);
goto bail;
}
// the array now has one ref, so drop this one
iput(new);
}
bail:
if (status)
mlog_errno(status);
return status;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/fs.h`, `linux/types.h`, `linux/slab.h`, `linux/highmem.h`, `linux/init.h`, `linux/random.h`, `linux/statfs.h`.
- Detected declarations: `struct mount_options`, `function ocfs2_osb_dump`, `function ocfs2_osb_debug_open`, `function ocfs2_debug_release`, `function ocfs2_debug_read`, `function ocfs2_osb_debug_open`, `function ocfs2_debug_release`, `function ocfs2_debug_read`, `function ocfs2_sync_fs`, `function ocfs2_need_system_inode`.
- 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.