fs/btrfs/qgroup.h
Source file repositories/reference/linux-study-clean/fs/btrfs/qgroup.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/qgroup.h- Extension
.h- Size
- 13891 bytes
- Lines
- 422
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/spinlock.hlinux/rbtree.hlinux/kobject.hlinux/list.huapi/linux/btrfs_tree.h
Detected Declarations
struct extent_bufferstruct extent_changesetstruct btrfs_delayed_extent_opstruct btrfs_fs_infostruct btrfs_rootstruct btrfs_ioctl_quota_ctl_argsstruct btrfs_trans_handlestruct btrfs_delayed_ref_rootstruct btrfs_inodestruct btrfs_transactionstruct btrfs_block_groupstruct btrfs_qgroup_swapped_blocksstruct btrfs_qgroup_extent_recordstruct btrfs_qgroup_swapped_blockstruct btrfs_qgroup_rsvstruct btrfs_qgroupstruct btrfs_qgroup_liststruct btrfs_squota_deltaenum btrfs_qgroup_rsv_typeenum btrfs_qgroup_modefunction btrfs_qgroup_subvolid
Annotated Snippet
struct btrfs_qgroup_extent_record {
/*
* The bytenr of the extent is given by its index in the dirty_extents
* xarray of struct btrfs_delayed_ref_root left shifted by
* fs_info->sectorsize_bits.
*/
u64 num_bytes;
/*
* For qgroup reserved data space freeing.
*
* @data_rsv_refroot and @data_rsv will be recorded after
* BTRFS_ADD_DELAYED_EXTENT is called.
* And will be used to free reserved qgroup space at
* transaction commit time.
*/
u32 data_rsv; /* reserved data space needs to be freed */
u64 data_rsv_refroot; /* which root the reserved data belongs to */
struct ulist *old_roots;
};
struct btrfs_qgroup_swapped_block {
struct rb_node node;
int level;
bool trace_leaf;
/* bytenr/generation of the tree block in subvolume tree after swap */
u64 subvol_bytenr;
u64 subvol_generation;
/* bytenr/generation of the tree block in reloc tree after swap */
u64 reloc_bytenr;
u64 reloc_generation;
u64 last_snapshot;
struct btrfs_key first_key;
};
/*
* Qgroup reservation types:
*
* DATA:
* space reserved for data
*
* META_PERTRANS:
* Space reserved for metadata (per-transaction)
* Due to the fact that qgroup data is only updated at transaction commit
* time, reserved space for metadata must be kept until transaction
* commits.
* Any metadata reserved that are used in btrfs_start_transaction() should
* be of this type.
*
* META_PREALLOC:
* There are cases where metadata space is reserved before starting
* transaction, and then btrfs_join_transaction() to get a trans handle.
* Any metadata reserved for such usage should be of this type.
* And after join_transaction() part (or all) of such reservation should
* be converted into META_PERTRANS.
*/
enum btrfs_qgroup_rsv_type {
BTRFS_QGROUP_RSV_DATA,
BTRFS_QGROUP_RSV_META_PERTRANS,
BTRFS_QGROUP_RSV_META_PREALLOC,
BTRFS_QGROUP_RSV_LAST,
};
/*
* Represents how many bytes we have reserved for this qgroup.
*
* Each type should have different reservation behavior.
* E.g, data follows its io_tree flag modification, while
* *currently* meta is just reserve-and-clear during transaction.
*
* TODO: Add new type for reservation which can survive transaction commit.
* Current metadata reservation behavior is not suitable for such case.
*/
struct btrfs_qgroup_rsv {
u64 values[BTRFS_QGROUP_RSV_LAST];
};
/*
* one struct for each qgroup, organized in fs_info->qgroup_tree.
*/
struct btrfs_qgroup {
u64 qgroupid;
/*
* state
Annotation
- Immediate include surface: `linux/types.h`, `linux/spinlock.h`, `linux/rbtree.h`, `linux/kobject.h`, `linux/list.h`, `uapi/linux/btrfs_tree.h`.
- Detected declarations: `struct extent_buffer`, `struct extent_changeset`, `struct btrfs_delayed_extent_op`, `struct btrfs_fs_info`, `struct btrfs_root`, `struct btrfs_ioctl_quota_ctl_args`, `struct btrfs_trans_handle`, `struct btrfs_delayed_ref_root`, `struct btrfs_inode`, `struct btrfs_transaction`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- 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.