fs/xfs/scrub/rtsummary.c
Source file repositories/reference/linux-study-clean/fs/xfs/scrub/rtsummary.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/scrub/rtsummary.c- Extension
.c- Size
- 9277 bytes
- Lines
- 370
- 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_trans_resv.hxfs_mount.hxfs_btree.hxfs_inode.hxfs_log_format.hxfs_trans.hxfs_rtbitmap.hxfs_bit.hxfs_bmap.hxfs_sb.hxfs_exchmaps.hxfs_rtgroup.hscrub/scrub.hscrub/common.hscrub/trace.hscrub/xfile.hscrub/repair.hscrub/tempexch.hscrub/rtsummary.h
Detected Declarations
function Copyrightfunction xfsum_loadfunction xfsum_storefunction xfsum_copyoutfunction xchk_rtsum_incfunction xchk_rtsum_record_freefunction xchk_rtsum_computefunction xchk_rtsum_comparefunction xchk_rtsummary
Annotated Snippet
if (nmap != 1 || !xfs_bmap_is_written_extent(&map)) {
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, off);
return 0;
}
off += map.br_blockcount;
}
for (off = 0; off < endoff; off++) {
union xfs_suminfo_raw *ondisk_info;
/* Read a block's worth of ondisk rtsummary file. */
error = xfs_rtsummary_read_buf(&rts->args, off);
if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, off, &error))
return error;
/* Read a block's worth of computed rtsummary file. */
error = xfsum_copyout(sc, sumoff, rts->words, mp->m_blockwsize);
if (error) {
xfs_rtbuf_cache_relse(&rts->args);
return error;
}
ondisk_info = xfs_rsumblock_infoptr(&rts->args, 0);
if (memcmp(ondisk_info, rts->words,
mp->m_blockwsize << XFS_WORDLOG) != 0) {
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, off);
xfs_rtbuf_cache_relse(&rts->args);
return error;
}
xfs_rtbuf_cache_relse(&rts->args);
sumoff += mp->m_blockwsize;
}
return 0;
}
/* Scrub the realtime summary. */
int
xchk_rtsummary(
struct xfs_scrub *sc)
{
struct xfs_mount *mp = sc->mp;
struct xfs_rtgroup *rtg = sc->sr.rtg;
struct xfs_inode *rbmip = rtg_bitmap(rtg);
struct xfs_inode *rsumip = rtg_summary(rtg);
struct xchk_rtsummary *rts = sc->buf;
int error;
/* Is sb_rextents correct? */
if (mp->m_sb.sb_rextents != rts->rextents) {
xchk_ip_set_corrupt(sc, rbmip);
return 0;
}
/* Is m_rsumlevels correct? */
if (mp->m_rsumlevels != rts->rsumlevels) {
xchk_ip_set_corrupt(sc, rsumip);
return 0;
}
/* Is m_rsumsize correct? */
if (mp->m_rsumblocks != rts->rsumblocks) {
xchk_ip_set_corrupt(sc, rsumip);
return 0;
}
/* The summary file length must be aligned to an fsblock. */
if (rsumip->i_disk_size & mp->m_blockmask) {
xchk_ip_set_corrupt(sc, rsumip);
return 0;
}
/*
* Is the summary file itself large enough to handle the rt volume?
* growfsrt expands the summary file before updating sb_rextents, so
* the file can be larger than rsumsize.
*/
if (rsumip->i_disk_size < XFS_FSB_TO_B(mp, rts->rsumblocks)) {
xchk_ip_set_corrupt(sc, rsumip);
return 0;
}
/* Invoke the fork scrubber. */
error = xchk_metadata_inode_forks(sc);
if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
return error;
/* Construct the new summary file from the rtbitmap. */
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_fs.h`, `xfs_shared.h`, `xfs_format.h`, `xfs_trans_resv.h`, `xfs_mount.h`, `xfs_btree.h`, `xfs_inode.h`.
- Detected declarations: `function Copyright`, `function xfsum_load`, `function xfsum_store`, `function xfsum_copyout`, `function xchk_rtsum_inc`, `function xchk_rtsum_record_free`, `function xchk_rtsum_compute`, `function xchk_rtsum_compare`, `function xchk_rtsummary`.
- 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.