fs/xfs/scrub/parent_repair.c
Source file repositories/reference/linux-study-clean/fs/xfs/scrub/parent_repair.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/scrub/parent_repair.c- Extension
.c- Size
- 41877 bytes
- Lines
- 1623
- 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
xfs_platform.hxfs_fs.hxfs_shared.hxfs_format.hxfs_trans_resv.hxfs_mount.hxfs_defer.hxfs_bit.hxfs_log_format.hxfs_trans.hxfs_sb.hxfs_inode.hxfs_icache.hxfs_da_format.hxfs_da_btree.hxfs_dir2.hxfs_bmap_btree.hxfs_dir2_priv.hxfs_trans_space.hxfs_health.hxfs_exchmaps.hxfs_parent.hxfs_attr.hxfs_bmap.hxfs_ag.hscrub/xfs_scrub.hscrub/scrub.hscrub/common.hscrub/trace.hscrub/repair.hscrub/iscan.hscrub/findparent.h
Detected Declarations
struct xrep_pptrstruct xrep_parentstruct xrep_parent_xattrfunction xrep_parent_teardownfunction xrep_setup_parentfunction xrep_parent_find_dotdotfunction xrep_parent_replay_updatefunction xrep_parent_replay_updatesfunction xrep_parent_stash_parentaddfunction xrep_parent_stash_parentremovefunction xrep_parent_scan_direntfunction xrep_parent_want_scanfunction xrep_parent_scan_ilockfunction xrep_parent_scan_filefunction xrep_parent_want_flush_stashedfunction xrep_parent_scan_dirtreefunction xrep_parent_live_updatefunction xchk_iscan_want_live_updatefunction xrep_parent_reset_dotdotfunction xrep_parent_lookup_pptrfunction xrep_parent_lookup_pptrsfunction xrep_parent_move_to_orphanagefunction xrep_parent_alloc_xattr_valuefunction xrep_parent_fetch_xattr_remotefunction xrep_parent_stash_xattrfunction xrep_parent_insert_xattrfunction xrep_parent_flush_xattrsfunction xrep_parent_want_flush_xattrsfunction xrep_parent_try_flush_xattrsfunction xrep_parent_copy_xattrsfunction xrep_parent_ensure_attr_forkfunction xrep_parent_finalize_tempfilefunction xrep_parent_rebuild_pptrsfunction structurefunction xrep_parent_count_pptrfunction xrep_parent_set_nondir_nlinkfunction xrep_parent_setup_scanfunction xrep_parent
Annotated Snippet
struct xrep_pptr {
/* Cookie for retrieval of the pptr name. */
xfblob_cookie name_cookie;
/* Parent pointer record. */
struct xfs_parent_rec pptr_rec;
/* Length of the pptr name. */
uint8_t namelen;
/* XREP_PPTR_{ADD,REMOVE} */
uint8_t action;
};
/*
* Stash up to 8 pages of recovered parent pointers in pptr_recs and
* pptr_names before we write them to the temp file.
*/
#define XREP_PARENT_MAX_STASH_BYTES (PAGE_SIZE * 8)
struct xrep_parent {
struct xfs_scrub *sc;
/* Fixed-size array of xrep_pptr structures. */
struct xfarray *pptr_recs;
/* Blobs containing parent pointer names. */
struct xfblob *pptr_names;
/* xattr keys */
struct xfarray *xattr_records;
/* xattr values */
struct xfblob *xattr_blobs;
/* Scratch buffers for saving extended attributes */
unsigned char *xattr_name;
void *xattr_value;
unsigned int xattr_value_sz;
/*
* Information used to exchange the attr fork mappings, if the fs
* supports parent pointers.
*/
struct xrep_tempexch tx;
/*
* Information used to scan the filesystem to find the inumber of the
* dotdot entry for this directory. On filesystems without parent
* pointers, we use the findparent_* functions on this object and
* access only the parent_ino field directly.
*
* When parent pointers are enabled, the directory entry scanner uses
* the iscan, hooks, and lock fields of this object directly.
* @pscan.lock coordinates access to pptr_recs, pptr_names, pptr, and
* pptr_scratch. This reduces the memory requirements of this
* structure.
*
* The lock also controls access to xattr_records and xattr_blobs(?)
*/
struct xrep_parent_scan_info pscan;
/* Orphanage reparenting request. */
struct xrep_adoption adoption;
/* Directory entry name, plus the trailing null. */
struct xfs_name xname;
unsigned char namebuf[MAXNAMELEN];
/* Scratch buffer for scanning pptr xattrs */
struct xfs_da_args pptr_args;
/* Have we seen any live updates of parent pointers recently? */
bool saw_pptr_updates;
/* Number of parents we found after all other repairs */
unsigned long long parents;
};
struct xrep_parent_xattr {
/* Cookie for retrieval of the xattr name. */
xfblob_cookie name_cookie;
/* Cookie for retrieval of the xattr value. */
xfblob_cookie value_cookie;
/* XFS_ATTR_* flags */
int flags;
/* Length of the value and name. */
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_fs.h`, `xfs_shared.h`, `xfs_format.h`, `xfs_trans_resv.h`, `xfs_mount.h`, `xfs_defer.h`, `xfs_bit.h`.
- Detected declarations: `struct xrep_pptr`, `struct xrep_parent`, `struct xrep_parent_xattr`, `function xrep_parent_teardown`, `function xrep_setup_parent`, `function xrep_parent_find_dotdot`, `function xrep_parent_replay_update`, `function xrep_parent_replay_updates`, `function xrep_parent_stash_parentadd`, `function xrep_parent_stash_parentremove`.
- 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.