fs/btrfs/delayed-inode.h
Source file repositories/reference/linux-study-clean/fs/btrfs/delayed-inode.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/delayed-inode.h- Extension
.h- Size
- 7802 bytes
- Lines
- 258
- 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/rbtree.hlinux/spinlock.hlinux/mutex.hlinux/list.hlinux/wait.hlinux/fs.hlinux/atomic.hlinux/refcount.hlinux/ref_tracker.hctree.h
Detected Declarations
struct btrfs_disk_keystruct btrfs_fs_infostruct btrfs_inodestruct btrfs_rootstruct btrfs_trans_handlestruct btrfs_ref_tracker_dirstruct btrfs_ref_trackerstruct btrfs_delayed_nodestruct btrfs_delayed_itemenum btrfs_delayed_item_typefunction btrfs_delayed_node_ref_tracker_dir_initfunction btrfs_delayed_node_ref_tracker_dir_exitfunction btrfs_delayed_node_ref_tracker_dir_printfunction btrfs_delayed_node_ref_tracker_allocfunction btrfs_delayed_node_ref_tracker_freefunction btrfs_delayed_node_ref_tracker_dir_initfunction btrfs_delayed_node_ref_tracker_free
Annotated Snippet
struct btrfs_ref_tracker_dir {
#ifdef CONFIG_BTRFS_DEBUG
struct ref_tracker_dir dir;
#else
struct {} tracker;
#endif
};
struct btrfs_ref_tracker {
#ifdef CONFIG_BTRFS_DEBUG
struct ref_tracker *tracker;
#else
struct {} tracker;
#endif
};
#define BTRFS_DELAYED_NODE_IN_LIST 0
#define BTRFS_DELAYED_NODE_INODE_DIRTY 1
#define BTRFS_DELAYED_NODE_DEL_IREF 2
struct btrfs_delayed_node {
u64 inode_id;
u64 bytes_reserved;
struct btrfs_root *root;
/* Used to add the node into the delayed root's node list. */
struct list_head n_list;
/*
* Used to add the node into the prepare list, the nodes in this list
* is waiting to be dealt with by the async worker.
*/
struct list_head p_list;
struct rb_root_cached ins_root;
struct rb_root_cached del_root;
struct mutex mutex;
struct btrfs_inode_item inode_item;
refcount_t refs;
int count;
u64 index_cnt;
unsigned long flags;
/*
* The size of the next batch of dir index items to insert (if this
* node is from a directory inode). Protected by @mutex.
*/
u32 curr_index_batch_size;
/*
* Number of leaves reserved for inserting dir index items (if this
* node belongs to a directory inode). This may be larger then the
* actual number of leaves we end up using. Protected by @mutex.
*/
u32 index_item_leaves;
/* Track all references to this delayed node. */
struct btrfs_ref_tracker_dir ref_dir;
/* Track delayed node reference stored in node list. */
struct btrfs_ref_tracker node_list_tracker;
/* Track delayed node reference stored in inode cache. */
struct btrfs_ref_tracker inode_cache_tracker;
};
struct btrfs_delayed_item {
struct rb_node rb_node;
/* Offset value of the corresponding dir index key. */
u64 index;
struct list_head tree_list; /* used for batch insert/delete items */
struct list_head readdir_list; /* used for readdir items */
/*
* Used when logging a directory.
* Insertions and deletions to this list are protected by the parent
* delayed node's mutex.
*/
struct list_head log_list;
u64 bytes_reserved;
struct btrfs_delayed_node *delayed_node;
refcount_t refs;
enum btrfs_delayed_item_type type:8;
/*
* Track if this delayed item was already logged.
* Protected by the mutex of the parent delayed inode.
*/
bool logged;
/* The maximum leaf size is 64K, so u16 is more than enough. */
u16 data_len;
char data[] __counted_by(data_len);
};
void btrfs_init_delayed_root(struct btrfs_delayed_root *delayed_root);
int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
const char *name, int name_len,
struct btrfs_inode *dir,
const struct btrfs_disk_key *disk_key, u8 flags,
u64 index);
Annotation
- Immediate include surface: `linux/types.h`, `linux/rbtree.h`, `linux/spinlock.h`, `linux/mutex.h`, `linux/list.h`, `linux/wait.h`, `linux/fs.h`, `linux/atomic.h`.
- Detected declarations: `struct btrfs_disk_key`, `struct btrfs_fs_info`, `struct btrfs_inode`, `struct btrfs_root`, `struct btrfs_trans_handle`, `struct btrfs_ref_tracker_dir`, `struct btrfs_ref_tracker`, `struct btrfs_delayed_node`, `struct btrfs_delayed_item`, `enum btrfs_delayed_item_type`.
- 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.