fs/btrfs/super.c
Source file repositories/reference/linux-study-clean/fs/btrfs/super.c
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/super.c- Extension
.c- Size
- 81057 bytes
- Lines
- 2742
- 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/blkdev.hlinux/module.hlinux/fs.hlinux/pagemap.hlinux/highmem.hlinux/time.hlinux/init.hlinux/seq_file.hlinux/string.hlinux/backing-dev.hlinux/mount.hlinux/writeback.hlinux/statfs.hlinux/compat.hlinux/parser.hlinux/ctype.hlinux/namei.hlinux/miscdevice.hlinux/magic.hlinux/slab.hlinux/ratelimit.hlinux/crc32c.hlinux/btrfs.hlinux/security.hlinux/fs_parser.hmessages.hdelayed-inode.hctree.hdisk-io.htransaction.hbtrfs_inode.hdirect-io.h
Detected Declarations
struct btrfs_fs_contextstruct init_sequencefunction btrfs_put_superfunction btrfs_match_compress_typefunction btrfs_parse_compressfunction btrfs_match_compress_typefunction btrfs_parse_paramfunction btrfs_clear_oneshot_optionsfunction check_ro_optionfunction btrfs_check_optionsfunction btrfs_set_free_space_cache_settingsfunction set_device_specific_optionsfunction get_default_subvol_objectidfunction btrfs_fill_superfunction btrfs_sync_fsfunction print_rescue_optionfunction btrfs_show_optionsfunction is_subvolume_inodefunction btrfs_resize_thread_poolfunction btrfs_remount_beginfunction btrfs_remount_cleanupfunction btrfs_remount_rwfunction btrfs_remount_rofunction btrfs_ctx_to_infofunction btrfs_info_to_ctxfunction btrfs_emit_optionsfunction btrfs_raw_test_optfunction btrfs_reconfigurefunction btrfs_cmp_device_free_bytesfunction btrfs_descending_sort_devicesfunction btrfs_calc_avail_data_spacefunction resultfunction list_for_each_entryfunction btrfs_fc_test_superfunction btrfs_get_tree_superfunction mountfunction btrfs_get_tree_subvolfunction btrfs_get_treefunction btrfs_kill_superfunction btrfs_free_fs_contextfunction btrfs_dup_fs_contextfunction btrfs_init_fs_contextfunction btrfs_control_openfunction btrfs_control_ioctlfunction btrfs_freezefunction check_dev_superfunction btrfs_unfreezefunction accident
Annotated Snippet
static const struct file_operations btrfs_ctl_fops = {
.open = btrfs_control_open,
.unlocked_ioctl = btrfs_control_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.owner = THIS_MODULE,
.llseek = noop_llseek,
};
static struct miscdevice btrfs_misc = {
.minor = BTRFS_MINOR,
.name = "btrfs-control",
.fops = &btrfs_ctl_fops
};
MODULE_ALIAS_MISCDEV(BTRFS_MINOR);
MODULE_ALIAS("devname:btrfs-control");
static int __init btrfs_interface_init(void)
{
return misc_register(&btrfs_misc);
}
static __cold void btrfs_interface_exit(void)
{
misc_deregister(&btrfs_misc);
}
static int __init btrfs_print_mod_info(void)
{
static const char options[] = ""
#ifdef CONFIG_BTRFS_EXPERIMENTAL
", experimental=on"
#endif
#ifdef CONFIG_BTRFS_DEBUG
", debug=on"
#endif
#ifdef CONFIG_BTRFS_ASSERT
", assert=on"
#endif
#ifdef CONFIG_BLK_DEV_ZONED
", zoned=yes"
#else
", zoned=no"
#endif
#ifdef CONFIG_FS_VERITY
", fsverity=yes"
#else
", fsverity=no"
#endif
;
#ifdef CONFIG_BTRFS_EXPERIMENTAL
if (btrfs_get_mod_read_policy() == NULL)
pr_info("Btrfs loaded%s\n", options);
else
pr_info("Btrfs loaded%s, read_policy=%s\n",
options, btrfs_get_mod_read_policy());
#else
pr_info("Btrfs loaded%s\n", options);
#endif
return 0;
}
static int register_btrfs(void)
{
return register_filesystem(&btrfs_fs_type);
}
static void unregister_btrfs(void)
{
unregister_filesystem(&btrfs_fs_type);
}
/* Helper structure for long init/exit functions. */
struct init_sequence {
int (*init_func)(void);
/* Can be NULL if the init_func doesn't need cleanup. */
void (*exit_func)(void);
};
static const struct init_sequence mod_init_seq[] = {
{
.init_func = btrfs_props_init,
.exit_func = NULL,
}, {
.init_func = btrfs_init_sysfs,
.exit_func = btrfs_exit_sysfs,
}, {
.init_func = btrfs_init_compress,
Annotation
- Immediate include surface: `linux/blkdev.h`, `linux/module.h`, `linux/fs.h`, `linux/pagemap.h`, `linux/highmem.h`, `linux/time.h`, `linux/init.h`, `linux/seq_file.h`.
- Detected declarations: `struct btrfs_fs_context`, `struct init_sequence`, `function btrfs_put_super`, `function btrfs_match_compress_type`, `function btrfs_parse_compress`, `function btrfs_match_compress_type`, `function btrfs_parse_param`, `function btrfs_clear_oneshot_options`, `function check_ro_option`, `function btrfs_check_options`.
- 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.