fs/xfs/libxfs/xfs_btree_mem.c
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_btree_mem.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_btree_mem.c- Extension
.c- Size
- 8281 bytes
- Lines
- 347
- 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_trans.hxfs_btree.hxfs_error.hxfs_buf_mem.hxfs_btree_mem.hxfs_ag.hxfs_buf_item.hxfs_trace.hxfs_rtgroup.h
Detected Declarations
function Copyrightfunction xfbtree_init_ptr_from_curfunction xfbtree_dup_cursorfunction xfbtree_destroyfunction xfbtree_rec_bytesfunction xfbtree_init_leaf_blockfunction xfbtree_initfunction xfbtree_alloc_blockfunction xfbtree_free_blockfunction xfbtree_get_minrecsfunction xfbtree_get_maxrecsfunction xfbtree_buf_matchfunction xfbtree_trans_commitfunction xfbtree_trans_cancelfunction list_for_each_entry_safe
Annotated Snippet
if (!bp) {
if (test_bit(XFS_LI_DIRTY, &lip->li_flags))
tp_dirty |= true;
continue;
}
trace_xfbtree_trans_commit_buf(xfbt, bp);
xmbuf_trans_bdetach(tp, bp);
/*
* If the buffer fails verification, note the failure but
* continue walking the transaction items so that we remove all
* ephemeral btree buffers.
*/
if (!error)
error = xmbuf_finalize(bp);
xfs_buf_relse(bp);
}
/*
* Reset the transaction's dirty flag to reflect the dirty state of the
* log items that are still attached.
*/
tp->t_flags = (tp->t_flags & ~XFS_TRANS_DIRTY) |
(tp_dirty ? XFS_TRANS_DIRTY : 0);
return error;
}
/*
* Cancel changes to the incore btree by detaching all the xfbtree buffers.
* Changes are not undone, so callers must not access the btree ever again.
*/
void
xfbtree_trans_cancel(
struct xfbtree *xfbt,
struct xfs_trans *tp)
{
struct xfs_log_item *lip, *n;
bool tp_dirty = false;
list_for_each_entry_safe(lip, n, &tp->t_items, li_trans) {
struct xfs_buf *bp = xfbtree_buf_match(xfbt, lip);
if (!bp) {
if (test_bit(XFS_LI_DIRTY, &lip->li_flags))
tp_dirty |= true;
continue;
}
trace_xfbtree_trans_cancel_buf(xfbt, bp);
xmbuf_trans_bdetach(tp, bp);
xfs_buf_relse(bp);
}
/*
* Reset the transaction's dirty flag to reflect the dirty state of the
* log items that are still attached.
*/
tp->t_flags = (tp->t_flags & ~XFS_TRANS_DIRTY) |
(tp_dirty ? XFS_TRANS_DIRTY : 0);
}
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_trans.h`.
- Detected declarations: `function Copyright`, `function xfbtree_init_ptr_from_cur`, `function xfbtree_dup_cursor`, `function xfbtree_destroy`, `function xfbtree_rec_bytes`, `function xfbtree_init_leaf_block`, `function xfbtree_init`, `function xfbtree_alloc_block`, `function xfbtree_free_block`, `function xfbtree_get_minrecs`.
- 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.