fs/btrfs/volumes.c
Source file repositories/reference/linux-study-clean/fs/btrfs/volumes.c
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/volumes.c- Extension
.c- Size
- 252468 bytes
- Lines
- 8977
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source 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.
- 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/sched.hlinux/sched/mm.hlinux/slab.hlinux/ratelimit.hlinux/kthread.hlinux/semaphore.hlinux/uuid.hlinux/list_sort.hlinux/namei.hmisc.hdisk-io.hextent-tree.htransaction.hvolumes.hraid56.hdev-replace.hsysfs.htree-checker.hspace-info.hblock-group.hdiscard.hzoned.hfs.haccessors.huuid-tree.hioctl.hrelocation.hscrub.hsuper.hraid-stripe-tree.h
Detected Declarations
struct btrfs_io_geometrystruct remap_chunk_infostruct alloc_chunk_ctlstruct stripe_mirrorfunction flagsfunction btrfs_nr_parity_stripesfunction btrfs_describe_block_groupsfunction btrfs_get_fs_uuidsfunction kfreefunction btrfs_free_devicefunction free_fs_devicesfunction btrfs_cleanup_fs_uuidsfunction match_fsid_fs_devicesfunction btrfs_get_bdev_and_sbfunction devicesfunction list_for_each_entry_safefunction list_for_each_entryfunction btrfs_open_one_devicefunction is_same_devicefunction list_for_each_entryfunction __btrfs_free_extra_devidsfunction btrfs_free_extra_devidsfunction btrfs_close_bdevfunction btrfs_close_one_devicefunction close_fs_devicesfunction btrfs_close_devicesfunction list_for_each_entry_safefunction open_fs_devicesfunction list_for_each_entry_safefunction devid_cmpfunction btrfs_open_devicesfunction btrfs_release_disk_superfunction btrfs_super_bytenrfunction btrfs_forget_devicesfunction btrfs_skip_registrationfunction list_for_each_entryfunction btrfs_first_pending_extentfunction btrfs_find_hole_in_pending_extentsfunction dev_extent_search_startfunction dev_extent_hole_check_zonedfunction regularfunction find_free_dev_extentfunction btrfs_free_dev_extentfunction find_next_chunkfunction find_next_devidfunction btrfs_add_dev_itemfunction update_dev_timefunction btrfs_rm_dev_item
Annotated Snippet
struct btrfs_io_geometry {
u32 stripe_index;
u32 stripe_nr;
int mirror_num;
int num_stripes;
u64 stripe_offset;
u64 raid56_full_stripe_start;
int max_errors;
enum btrfs_map_op op;
bool use_rst;
};
const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
[BTRFS_RAID_RAID10] = {
.sub_stripes = 2,
.dev_stripes = 1,
.devs_max = 0, /* 0 == as many as possible */
.devs_min = 2,
.tolerated_failures = 1,
.devs_increment = 2,
.ncopies = 2,
.nparity = 0,
.raid_name = "raid10",
.bg_flag = BTRFS_BLOCK_GROUP_RAID10,
.mindev_error = BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET,
},
[BTRFS_RAID_RAID1] = {
.sub_stripes = 1,
.dev_stripes = 1,
.devs_max = 2,
.devs_min = 2,
.tolerated_failures = 1,
.devs_increment = 2,
.ncopies = 2,
.nparity = 0,
.raid_name = "raid1",
.bg_flag = BTRFS_BLOCK_GROUP_RAID1,
.mindev_error = BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET,
},
[BTRFS_RAID_RAID1C3] = {
.sub_stripes = 1,
.dev_stripes = 1,
.devs_max = 3,
.devs_min = 3,
.tolerated_failures = 2,
.devs_increment = 3,
.ncopies = 3,
.nparity = 0,
.raid_name = "raid1c3",
.bg_flag = BTRFS_BLOCK_GROUP_RAID1C3,
.mindev_error = BTRFS_ERROR_DEV_RAID1C3_MIN_NOT_MET,
},
[BTRFS_RAID_RAID1C4] = {
.sub_stripes = 1,
.dev_stripes = 1,
.devs_max = 4,
.devs_min = 4,
.tolerated_failures = 3,
.devs_increment = 4,
.ncopies = 4,
.nparity = 0,
.raid_name = "raid1c4",
.bg_flag = BTRFS_BLOCK_GROUP_RAID1C4,
.mindev_error = BTRFS_ERROR_DEV_RAID1C4_MIN_NOT_MET,
},
[BTRFS_RAID_DUP] = {
.sub_stripes = 1,
.dev_stripes = 2,
.devs_max = 1,
.devs_min = 1,
.tolerated_failures = 0,
.devs_increment = 1,
.ncopies = 2,
.nparity = 0,
.raid_name = "dup",
.bg_flag = BTRFS_BLOCK_GROUP_DUP,
.mindev_error = 0,
},
[BTRFS_RAID_RAID0] = {
.sub_stripes = 1,
.dev_stripes = 1,
.devs_max = 0,
.devs_min = 1,
.tolerated_failures = 0,
.devs_increment = 1,
.ncopies = 1,
.nparity = 0,
.raid_name = "raid0",
.bg_flag = BTRFS_BLOCK_GROUP_RAID0,
.mindev_error = 0,
Annotation
- Immediate include surface: `linux/sched.h`, `linux/sched/mm.h`, `linux/slab.h`, `linux/ratelimit.h`, `linux/kthread.h`, `linux/semaphore.h`, `linux/uuid.h`, `linux/list_sort.h`.
- Detected declarations: `struct btrfs_io_geometry`, `struct remap_chunk_info`, `struct alloc_chunk_ctl`, `struct stripe_mirror`, `function flags`, `function btrfs_nr_parity_stripes`, `function btrfs_describe_block_groups`, `function btrfs_get_fs_uuids`, `function kfree`, `function btrfs_free_device`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source 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.