fs/btrfs/btrfs_inode.h
Source file repositories/reference/linux-study-clean/fs/btrfs/btrfs_inode.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/btrfs_inode.h- Extension
.h- Size
- 22560 bytes
- Lines
- 641
- 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/hash.hlinux/refcount.hlinux/spinlock.hlinux/mutex.hlinux/rwsem.hlinux/fs.hlinux/mm.hlinux/compiler.hlinux/fscrypt.hlinux/lockdep.huapi/linux/btrfs_tree.htrace/events/btrfs.hctree.hblock-rsv.hextent_map.hextent-io-tree.h
Detected Declarations
struct posix_aclstruct iov_iterstruct writeback_controlstruct btrfs_rootstruct btrfs_fs_infostruct btrfs_trans_handlestruct btrfs_biostruct btrfs_file_extentstruct btrfs_delayed_nodestruct btrfs_inodestruct btrfs_new_inode_argsenum btrfs_ilock_typefunction btrfs_get_first_dir_index_to_logfunction btrfs_set_first_dir_index_to_logfunction btrfs_inode_hashfunction btrfs_inofunction btrfs_get_inode_keyfunction btrfs_set_inode_numberfunction btrfs_i_size_writefunction btrfs_is_free_space_inodefunction is_data_inodefunction btrfs_mod_outstanding_extentsfunction btrfs_set_inode_last_sub_transfunction concurrentlyfunction btrfs_inode_in_logfunction btrfs_inode_can_compressfunction btrfs_assert_inode_lockedfunction btrfs_update_inode_mapping_flagsfunction btrfs_set_inode_mapping_order
Annotated Snippet
struct btrfs_inode {
/* which subvolume this inode belongs to */
struct btrfs_root *root;
/* Cached value of inode property 'compression'. */
u8 prop_compress;
/*
* Force compression on the file using the defrag ioctl, could be
* different from prop_compress and takes precedence if set.
*/
u8 defrag_compress;
s8 defrag_compress_level;
/*
* Lock for counters and all fields used to determine if the inode is in
* the log or not (last_trans, last_sub_trans, last_log_commit,
* logged_trans), to access/update delalloc_bytes, new_delalloc_bytes,
* defrag_bytes, disk_i_size, outstanding_extents, csum_bytes and to
* update the VFS' inode number of bytes used.
* Also protects setting struct file::private_data.
*/
spinlock_t lock;
/* the extent_tree has caches of all the extent mappings to disk */
struct extent_map_tree extent_tree;
/* the io_tree does range state (DIRTY, LOCKED etc) */
struct extent_io_tree io_tree;
/*
* Keep track of where the inode has extent items mapped in order to
* make sure the i_size adjustments are accurate. Not required when the
* filesystem is NO_HOLES, the status can't be set while mounted as
* it's a mkfs-time feature.
*/
struct extent_io_tree *file_extent_tree;
/* held while logging the inode in tree-log.c */
struct mutex log_mutex;
/*
* Counters to keep track of the number of extent item's we may use due
* to delalloc and such. outstanding_extents is the number of extent
* items we think we'll end up using, and reserved_extents is the number
* of extent items we've reserved metadata for. Protected by 'lock'.
*/
unsigned outstanding_extents;
/* used to order data wrt metadata */
spinlock_t ordered_tree_lock;
struct rb_root ordered_tree;
struct rb_node *ordered_tree_last;
/* list of all the delalloc inodes in the FS. There are times we need
* to write all the delalloc pages to disk, and this list is used
* to walk them all.
*/
struct list_head delalloc_inodes;
unsigned long runtime_flags;
/* full 64 bit generation number, struct vfs_inode doesn't have a big
* enough field for this.
*/
u64 generation;
/*
* ID of the transaction handle that last modified this inode.
* Protected by 'lock'.
*/
u64 last_trans;
/*
* ID of the transaction that last logged this inode.
* Protected by 'lock'.
*/
u64 logged_trans;
/*
* Log transaction ID when this inode was last modified.
* Protected by 'lock'.
*/
int last_sub_trans;
/* A local copy of root's last_log_commit. Protected by 'lock'. */
int last_log_commit;
union {
/*
Annotation
- Immediate include surface: `linux/hash.h`, `linux/refcount.h`, `linux/spinlock.h`, `linux/mutex.h`, `linux/rwsem.h`, `linux/fs.h`, `linux/mm.h`, `linux/compiler.h`.
- Detected declarations: `struct posix_acl`, `struct iov_iter`, `struct writeback_control`, `struct btrfs_root`, `struct btrfs_fs_info`, `struct btrfs_trans_handle`, `struct btrfs_bio`, `struct btrfs_file_extent`, `struct btrfs_delayed_node`, `struct btrfs_inode`.
- 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.