fs/btrfs/delayed-ref.h
Source file repositories/reference/linux-study-clean/fs/btrfs/delayed-ref.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/delayed-ref.h- Extension
.h- Size
- 13218 bytes
- Lines
- 460
- 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/refcount.hlinux/list.hlinux/rbtree.hlinux/mutex.hlinux/spinlock.hlinux/slab.huapi/linux/btrfs_tree.hfs.hmessages.h
Detected Declarations
struct btrfs_trans_handlestruct btrfs_fs_infostruct btrfs_data_refstruct btrfs_tree_refstruct btrfs_delayed_ref_nodestruct btrfs_delayed_extent_opstruct btrfs_delayed_ref_headstruct btrfs_delayed_ref_rootstruct btrfs_refenum btrfs_delayed_ref_actionenum btrfs_delayed_ref_flagsenum btrfs_ref_typefunction btrfs_calc_delayed_ref_bytesfunction btrfs_calc_delayed_ref_csum_bytesfunction btrfs_alloc_delayed_extent_opfunction btrfs_free_delayed_extent_opfunction btrfs_ref_head_to_space_flagsfunction btrfs_put_delayed_ref_headfunction btrfs_delayed_ref_unlockfunction btrfs_delayed_ref_ownerfunction btrfs_delayed_ref_offsetfunction btrfs_ref_type
Annotated Snippet
struct btrfs_data_ref {
/* For EXTENT_DATA_REF */
/* Inode which refers to this data extent */
u64 objectid;
/*
* file_offset - extent_offset
*
* file_offset is the key.offset of the EXTENT_DATA key.
* extent_offset is btrfs_file_extent_offset() of the EXTENT_DATA data.
*/
u64 offset;
};
struct btrfs_tree_ref {
/*
* Level of this tree block.
*
* Shared for skinny (TREE_BLOCK_REF) and normal tree ref.
*/
int level;
/* For non-skinny metadata, no special member needed */
};
struct btrfs_delayed_ref_node {
struct rb_node ref_node;
/*
* If action is BTRFS_ADD_DELAYED_REF, also link this node to
* ref_head->ref_add_list, then we do not need to iterate the
* refs rbtree in the corresponding delayed ref head
* (struct btrfs_delayed_ref_head::ref_tree).
*/
struct list_head add_list;
/* the starting bytenr of the extent */
u64 bytenr;
/* the size of the extent */
u64 num_bytes;
/* seq number to keep track of insertion order */
u64 seq;
/* The ref_root for this ref */
u64 ref_root;
/*
* The parent for this ref, if this isn't set the ref_root is the
* reference owner.
*/
u64 parent;
/* ref count on this data structure */
refcount_t refs;
/*
* how many refs is this entry adding or deleting. For
* head refs, this may be a negative number because it is keeping
* track of the total mods done to the reference count.
* For individual refs, this will always be a positive number
*
* It may be more than one, since it is possible for a single
* parent to have more than one ref on an extent
*/
int ref_mod;
unsigned int action:8;
unsigned int type:8;
union {
struct btrfs_tree_ref tree_ref;
struct btrfs_data_ref data_ref;
};
};
struct btrfs_delayed_extent_op {
struct btrfs_disk_key key;
bool update_key;
bool update_flags;
u64 flags_to_set;
};
/*
* the head refs are used to hold a lock on a given extent, which allows us
* to make sure that only one process is running the delayed refs
* at a time for a single extent. They also store the sum of all the
* reference count modifications we've queued up.
*/
Annotation
- Immediate include surface: `linux/types.h`, `linux/refcount.h`, `linux/list.h`, `linux/rbtree.h`, `linux/mutex.h`, `linux/spinlock.h`, `linux/slab.h`, `uapi/linux/btrfs_tree.h`.
- Detected declarations: `struct btrfs_trans_handle`, `struct btrfs_fs_info`, `struct btrfs_data_ref`, `struct btrfs_tree_ref`, `struct btrfs_delayed_ref_node`, `struct btrfs_delayed_extent_op`, `struct btrfs_delayed_ref_head`, `struct btrfs_delayed_ref_root`, `struct btrfs_ref`, `enum btrfs_delayed_ref_action`.
- 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.