include/uapi/linux/btrfs_tree.h
Source file repositories/reference/linux-study-clean/include/uapi/linux/btrfs_tree.h
File Facts
- System
- Linux kernel
- Corpus path
include/uapi/linux/btrfs_tree.h- Extension
.h- Size
- 36588 bytes
- Lines
- 1358
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/btrfs.hlinux/types.hlinux/stddef.hstddef.h
Detected Declarations
struct btrfs_disk_keystruct btrfs_keystruct btrfs_headerstruct btrfs_root_backupstruct btrfs_itemstruct btrfs_leafstruct btrfs_key_ptrstruct btrfs_nodestruct btrfs_dev_itemstruct btrfs_stripestruct btrfs_chunkstruct btrfs_super_blockstruct btrfs_free_space_entrystruct btrfs_free_space_headerstruct btrfs_raid_stridestruct btrfs_stripe_extentstruct btrfs_extent_itemstruct btrfs_extent_item_v0struct btrfs_tree_block_infostruct btrfs_extent_data_refstruct btrfs_shared_data_refstruct btrfs_extent_owner_refstruct btrfs_extent_inline_refstruct btrfs_dev_extentstruct btrfs_inode_refstruct btrfs_inode_extrefstruct btrfs_timespecstruct btrfs_inode_itemstruct btrfs_dir_log_itemstruct btrfs_dir_itemstruct btrfs_root_itemstruct btrfs_root_refstruct btrfs_disk_balance_argsstruct btrfs_balance_itemstruct btrfs_file_extent_itemstruct btrfs_csum_itemstruct btrfs_dev_stats_itemstruct btrfs_dev_replace_itemstruct btrfs_block_group_itemstruct btrfs_block_group_item_v2struct btrfs_free_space_infostruct btrfs_qgroup_status_itemstruct btrfs_qgroup_info_itemstruct btrfs_qgroup_limit_itemstruct btrfs_verity_descriptor_itemstruct btrfs_remap_itemenum btrfs_csum_typefunction btrfs_dir_flags_to_ftype
Annotated Snippet
struct btrfs_disk_key {
__le64 objectid;
__u8 type;
__le64 offset;
} __attribute__ ((__packed__));
struct btrfs_key {
__u64 objectid;
__u8 type;
__u64 offset;
} __attribute__ ((__packed__));
/*
* Every tree block (leaf or node) starts with this header.
*/
struct btrfs_header {
/* These first four must match the super block */
__u8 csum[BTRFS_CSUM_SIZE];
/* FS specific uuid */
__u8 fsid[BTRFS_FSID_SIZE];
/* Which block this node is supposed to live in */
__le64 bytenr;
__le64 flags;
/* Allowed to be different from the super from here on down */
__u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
__le64 generation;
__le64 owner;
__le32 nritems;
__u8 level;
} __attribute__ ((__packed__));
/*
* This is a very generous portion of the super block, giving us room to
* translate 14 chunks with 3 stripes each.
*/
#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
/*
* Just in case we somehow lose the roots and are not able to mount, we store
* an array of the roots from previous transactions in the super.
*/
#define BTRFS_NUM_BACKUP_ROOTS 4
struct btrfs_root_backup {
__le64 tree_root;
__le64 tree_root_gen;
__le64 chunk_root;
__le64 chunk_root_gen;
__le64 extent_root;
__le64 extent_root_gen;
__le64 fs_root;
__le64 fs_root_gen;
__le64 dev_root;
__le64 dev_root_gen;
__le64 csum_root;
__le64 csum_root_gen;
__le64 total_bytes;
__le64 bytes_used;
__le64 num_devices;
/* future */
__le64 unused_64[4];
__u8 tree_root_level;
__u8 chunk_root_level;
__u8 extent_root_level;
__u8 fs_root_level;
__u8 dev_root_level;
__u8 csum_root_level;
/* future and to align */
__u8 unused_8[10];
} __attribute__ ((__packed__));
/*
* A leaf is full of items. offset and size tell us where to find the item in
* the leaf (relative to the start of the data area)
*/
struct btrfs_item {
struct btrfs_disk_key key;
__le32 offset;
__le32 size;
} __attribute__ ((__packed__));
/*
* Leaves have an item area and a data area:
Annotation
- Immediate include surface: `linux/btrfs.h`, `linux/types.h`, `linux/stddef.h`, `stddef.h`.
- Detected declarations: `struct btrfs_disk_key`, `struct btrfs_key`, `struct btrfs_header`, `struct btrfs_root_backup`, `struct btrfs_item`, `struct btrfs_leaf`, `struct btrfs_key_ptr`, `struct btrfs_node`, `struct btrfs_dev_item`, `struct btrfs_stripe`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
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.