fs/xfs/libxfs/xfs_da_format.h
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_da_format.h
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_da_format.h- Extension
.h- Size
- 31082 bytes
- Lines
- 908
- 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
- No C-style include directives detected by the generator.
Detected Declarations
struct xfs_da3_blkinfostruct xfs_da3_node_hdrstruct xfs_da3_intnodestruct xfs_dir3_blk_hdrstruct xfs_dir3_data_hdrstruct xfs_dir3_leaf_hdrstruct xfs_dir3_leafstruct xfs_dir3_free_hdrstruct xfs_dir3_freestruct xfs_attr_sf_hdrstruct xfs_attr_sf_entrystruct xfs_attr3_leaf_hdrstruct xfs_attr3_leafblockstruct xfs_attr3_rmt_hdrstruct xfs_parent_recfunction xfs_dir2_sf_hdr_sizefunction xfs_dir2_sf_get_offsetfunction xfs_dir2_sf_put_offsetfunction xfs_dir2_sf_firstentryfunction xfs_dir2_data_unused_tag_pfunction xfs_dir2_leaf_bests_pfunction blockfunction entriesfunction xfs_attr3_leaf_entrypfunction xfs_attr3_leaf_namefunction xfs_attr3_leaf_name_remotefunction xfs_attr3_leaf_name_localfunction usedfunction xfs_attr_leaf_entsize_localfunction xfs_attr_leaf_entsize_local_maxfunction xfs_dir2_dirblock_bytes
Annotated Snippet
struct xfs_da3_blkinfo {
/*
* the node link manipulation code relies on the fact that the first
* element of this structure is the struct xfs_da_blkinfo so it can
* ignore the differences in the rest of the structures.
*/
struct xfs_da_blkinfo hdr;
__be32 crc; /* CRC of block */
__be64 blkno; /* first block of the buffer */
__be64 lsn; /* sequence number of last write */
uuid_t uuid; /* filesystem we belong to */
__be64 owner; /* inode that owns the block */
};
/*
* This is the structure of the root and intermediate nodes in the Btree.
* The leaf nodes are defined above.
*
* Entries are not packed.
*
* Since we have duplicate keys, use a binary search but always follow
* all match in the block, not just the first match found.
*/
#define XFS_DA_NODE_MAXDEPTH 5 /* max depth of Btree */
typedef struct xfs_da_node_hdr {
struct xfs_da_blkinfo info; /* block type, links, etc. */
__be16 __count; /* count of active entries */
__be16 __level; /* level above leaves (leaf == 0) */
} xfs_da_node_hdr_t;
struct xfs_da3_node_hdr {
struct xfs_da3_blkinfo info; /* block type, links, etc. */
__be16 __count; /* count of active entries */
__be16 __level; /* level above leaves (leaf == 0) */
__be32 __pad32;
};
#define XFS_DA3_NODE_CRC_OFF (offsetof(struct xfs_da3_node_hdr, info.crc))
typedef struct xfs_da_node_entry {
__be32 hashval; /* hash value for this descendant */
__be32 before; /* Btree block before this key */
} xfs_da_node_entry_t;
typedef struct xfs_da_intnode {
struct xfs_da_node_hdr hdr;
struct xfs_da_node_entry __btree[];
} xfs_da_intnode_t;
struct xfs_da3_intnode {
struct xfs_da3_node_hdr hdr;
struct xfs_da_node_entry __btree[];
};
/*
* Directory version 2.
*
* There are 4 possible formats:
* - shortform - embedded into the inode
* - single block - data with embedded leaf at the end
* - multiple data blocks, single leaf+freeindex block
* - data blocks, node and leaf blocks (btree), freeindex blocks
*
* Note: many node blocks structures and constants are shared with the attr
* code and defined in xfs_da_btree.h.
*/
#define XFS_DIR2_BLOCK_MAGIC 0x58443242 /* XD2B: single block dirs */
#define XFS_DIR2_DATA_MAGIC 0x58443244 /* XD2D: multiblock dirs */
#define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F: free index blocks */
/*
* Directory Version 3 With CRCs.
*
* The tree formats are the same as for version 2 directories. The difference
* is in the block header and dirent formats. In many cases the v3 structures
* use v2 definitions as they are no different and this makes code sharing much
* easier.
*
* Also, the xfs_dir3_*() functions handle both v2 and v3 formats - if the
* format is v2 then they switch to the existing v2 code, or the format is v3
* they implement the v3 functionality. This means the existing dir2 is a mix of
* xfs_dir2/xfs_dir3 calls and functions. The xfs_dir3 functions are called
* where there is a difference in the formats, otherwise the code is unchanged.
*
* Where it is possible, the code decides what to do based on the magic numbers
* in the blocks rather than feature bits in the superblock. This means the code
* is as independent of the external XFS code as possible as doesn't require
* passing struct xfs_mount pointers into places where it isn't really
Annotation
- Detected declarations: `struct xfs_da3_blkinfo`, `struct xfs_da3_node_hdr`, `struct xfs_da3_intnode`, `struct xfs_dir3_blk_hdr`, `struct xfs_dir3_data_hdr`, `struct xfs_dir3_leaf_hdr`, `struct xfs_dir3_leaf`, `struct xfs_dir3_free_hdr`, `struct xfs_dir3_free`, `struct xfs_attr_sf_hdr`.
- 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.