fs/xfs/libxfs/xfs_attr.c
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_attr.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_attr.c- Extension
.c- Size
- 41977 bytes
- Lines
- 1662
- 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
xfs_platform.hxfs_fs.hxfs_shared.hxfs_format.hxfs_log_format.hxfs_trans_resv.hxfs_mount.hxfs_defer.hxfs_da_format.hxfs_da_btree.hxfs_attr_sf.hxfs_inode.hxfs_trans.hxfs_bmap.hxfs_bmap_btree.hxfs_attr.hxfs_attr_leaf.hxfs_attr_remote.hxfs_quota.hxfs_trans_space.hxfs_trace.hxfs_attr_item.hxfs_xattr.hxfs_parent.h
Detected Declarations
function xfs_inode_hasattrfunction xfs_attr_is_leaffunction XXXfunction xfs_attr_refillstatefunction xfs_attr_fillstatefunction xfs_attr_get_ilockedfunction xfs_attr_getfunction xfs_attr_calc_sizefunction xfs_attr_set_resvfunction xfs_attr_shortform_addnamefunction xfs_attr_sf_addnamefunction xfs_attr_hashnamefunction xfs_attr_hashvalfunction xfs_attr_save_rmt_blkfunction xfs_attr_restore_rmt_blkfunction xfs_attr_update_pptr_replace_argsfunction xfs_attr_complete_opfunction xfs_attr_leaf_addnamefunction xfs_attr_node_addnamefunction xfs_attr_rmtval_allocfunction xfs_attr_leaf_mark_incompletefunction xfs_attr_item_init_da_statefunction xfs_attr_node_removename_setupfunction xfs_attr_leaf_remove_attrfunction xfs_attr_leaf_shrinkfunction xfs_attr_set_iterfunction xfs_attr_lookupfunction xfs_attr_can_shortcutfunction xfs_attr_setnamefunction xfs_attr_removenamefunction xfs_attr_replacenamefunction xfs_attr_setfunction xfs_attr_sf_totsizefunction xfs_attr_shortform_addnamefunction bmap_one_blockfunction bmap_one_blockfunction xfs_attr_node_lookupfunction xfs_attr_node_addname_find_attrfunction nodefunction xfs_attr_node_removenamefunction xfs_attr_node_remove_attrfunction xfs_attr_node_getfunction xfs_attr_check_namespacefunction xfs_attr_namecheckfunction xfs_attr_intent_init_cachefunction xfs_attr_intent_destroy_cache
Annotated Snippet
if (blk->bp) {
blk->disk_blkno = xfs_buf_daddr(blk->bp);
blk->bp = NULL;
} else {
blk->disk_blkno = 0;
}
}
/*
* Roll down the "altpath" in the state structure, storing the on-disk
* block number for those buffers in the "altpath".
*/
path = &state->altpath;
ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH));
for (blk = path->blk, level = 0; level < path->active; blk++, level++) {
if (blk->bp) {
blk->disk_blkno = xfs_buf_daddr(blk->bp);
blk->bp = NULL;
} else {
blk->disk_blkno = 0;
}
}
return 0;
}
/*
* Reattach the buffers to the state structure based on the disk block
* numbers stored in the state structure.
* This is done after some set of transaction commits have released those
* buffers from our grip.
*/
static int
xfs_attr_refillstate(xfs_da_state_t *state)
{
xfs_da_state_path_t *path;
xfs_da_state_blk_t *blk;
int level, error;
trace_xfs_attr_refillstate(state->args);
/*
* Roll down the "path" in the state structure, storing the on-disk
* block number for those buffers in the "path".
*/
path = &state->path;
ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH));
for (blk = path->blk, level = 0; level < path->active; blk++, level++) {
if (blk->disk_blkno) {
error = xfs_da3_node_read_mapped(state->args->trans,
state->args->dp, blk->disk_blkno,
&blk->bp, XFS_ATTR_FORK);
if (error)
return error;
} else {
blk->bp = NULL;
}
}
/*
* Roll down the "altpath" in the state structure, storing the on-disk
* block number for those buffers in the "altpath".
*/
path = &state->altpath;
ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH));
for (blk = path->blk, level = 0; level < path->active; blk++, level++) {
if (blk->disk_blkno) {
error = xfs_da3_node_read_mapped(state->args->trans,
state->args->dp, blk->disk_blkno,
&blk->bp, XFS_ATTR_FORK);
if (error)
return error;
} else {
blk->bp = NULL;
}
}
return 0;
}
#else
static int xfs_attr_fillstate(xfs_da_state_t *state) { return 0; }
#endif
/*========================================================================
* Overall external interface routines.
*========================================================================*/
/*
* Retrieve an extended attribute and its value. Must have ilock.
* Returns 0 on successful retrieval, otherwise an error.
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_fs.h`, `xfs_shared.h`, `xfs_format.h`, `xfs_log_format.h`, `xfs_trans_resv.h`, `xfs_mount.h`, `xfs_defer.h`.
- Detected declarations: `function xfs_inode_hasattr`, `function xfs_attr_is_leaf`, `function XXX`, `function xfs_attr_refillstate`, `function xfs_attr_fillstate`, `function xfs_attr_get_ilocked`, `function xfs_attr_get`, `function xfs_attr_calc_size`, `function xfs_attr_set_resv`, `function xfs_attr_shortform_addname`.
- 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.