fs/btrfs/inode-item.h
Source file repositories/reference/linux-study-clean/fs/btrfs/inode-item.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/inode-item.h- Extension
.h- Size
- 3363 bytes
- Lines
- 117
- 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/crc32c.h
Detected Declarations
struct fscrypt_strstruct extent_bufferstruct btrfs_trans_handlestruct btrfs_rootstruct btrfs_pathstruct btrfs_keystruct btrfs_inode_extrefstruct btrfs_inodestruct btrfs_truncate_controlstruct btrfs_truncate_controlfunction btrfs_inode_combine_flagsfunction btrfs_inode_split_flagsfunction btrfs_extref_hash
Annotated Snippet
struct btrfs_truncate_control {
/*
* IN: the inode we're operating on, this can be NULL if
* ->clear_extent_range is false.
*/
struct btrfs_inode *inode;
/* IN: the size we're truncating to. */
u64 new_size;
/* OUT: the number of extents truncated. */
u64 extents_found;
/* OUT: the last size we truncated this inode to. */
u64 last_size;
/* OUT: the number of bytes to sub from this inode. */
u64 sub_bytes;
/* IN: the ino we are truncating. */
u64 ino;
/*
* IN: minimum key type to remove. All key types with this type are
* removed only if their offset >= new_size.
*/
u32 min_type;
/*
* IN: true if we don't want to do extent reference updates for any file
* extents we drop.
*/
bool skip_ref_updates;
/*
* IN: true if we need to clear the file extent range for the inode as
* we drop the file extent items.
*/
bool clear_extent_range;
};
/*
* btrfs_inode_item stores flags in a u64, btrfs_inode stores them in two
* separate u32s. These two functions convert between the two representations.
*/
static inline u64 btrfs_inode_combine_flags(u32 flags, u32 ro_flags)
{
return (flags | ((u64)ro_flags << 32));
}
static inline void btrfs_inode_split_flags(u64 inode_item_flags,
u32 *flags, u32 *ro_flags)
{
*flags = (u32)inode_item_flags;
*ro_flags = (u32)(inode_item_flags >> 32);
}
/* Figure the key offset of an extended inode ref. */
static inline u64 btrfs_extref_hash(u64 parent_objectid, const char *name, int len)
{
return (u64)crc32c(parent_objectid, name, len);
}
int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_truncate_control *control);
int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root, const struct fscrypt_str *name,
u64 inode_objectid, u64 ref_objectid, u64 index);
int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root, const struct fscrypt_str *name,
u64 inode_objectid, u64 ref_objectid, u64 *index);
int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path, u64 objectid);
int btrfs_lookup_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_path *path,
struct btrfs_key *location, int mod);
struct btrfs_inode_extref *btrfs_lookup_inode_extref(struct btrfs_root *root,
struct btrfs_path *path,
const struct fscrypt_str *name,
u64 inode_objectid, u64 ref_objectid);
struct btrfs_inode_ref *btrfs_find_name_in_backref(const struct extent_buffer *leaf,
int slot,
const struct fscrypt_str *name);
struct btrfs_inode_extref *btrfs_find_name_in_ext_backref(
const struct extent_buffer *leaf, int slot, u64 ref_objectid,
const struct fscrypt_str *name);
Annotation
- Immediate include surface: `linux/types.h`, `linux/crc32c.h`.
- Detected declarations: `struct fscrypt_str`, `struct extent_buffer`, `struct btrfs_trans_handle`, `struct btrfs_root`, `struct btrfs_path`, `struct btrfs_key`, `struct btrfs_inode_extref`, `struct btrfs_inode`, `struct btrfs_truncate_control`, `struct btrfs_truncate_control`.
- 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.