fs/xfs/libxfs/xfs_inode_buf.c
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_inode_buf.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_inode_buf.c- Extension
.c- Size
- 27414 bytes
- Lines
- 975
- 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_ag.hxfs_inode.hxfs_errortag.hxfs_error.hxfs_icache.hxfs_trans.hxfs_ialloc.hxfs_dir2.hxfs_health.hxfs_metafile.hlinux/iversion.h
Detected Declarations
function xfs_dquot_buf_readahead_verifyfunction xfs_inode_buf_read_verifyfunction xfs_inode_buf_readahead_verifyfunction xfs_inode_buf_write_verifyfunction xfs_read_iclusterfunction xfs_inode_decode_bigtimefunction xfs_inode_from_disk_tsfunction xfs_inode_from_diskfunction xfs_inode_to_disk_tsfunction xfs_inode_to_disk_iext_countersfunction xfs_inode_to_diskfunction xfs_dinode_verify_forkfunction addedfunction xfs_dinode_verify_forkofffunction xfs_dinode_verify_nrext64function xfs_dinode_verify_metadirfunction xfs_dinode_verifyfunction inodesfunction xfs_dinode_calc_crcfunction xfs_inode_validate_extsizefunction xfs_inode_validate_cowextsize
Annotated Snippet
XFS_TEST_ERROR(mp, XFS_ERRTAG_ITOBP_INOTOBP))) {
if (readahead) {
bp->b_flags &= ~XBF_DONE;
xfs_buf_ioerror(bp, -EIO);
return;
}
#ifdef DEBUG
xfs_alert(mp,
"bad inode magic/vsn daddr %lld #%d (magic=%x)",
(unsigned long long)xfs_buf_daddr(bp), i,
be16_to_cpu(dip->di_magic));
#endif
xfs_buf_verifier_error(bp, -EFSCORRUPTED,
__func__, dip, sizeof(*dip),
NULL);
return;
}
}
}
static void
xfs_inode_buf_read_verify(
struct xfs_buf *bp)
{
xfs_inode_buf_verify(bp, false);
}
static void
xfs_inode_buf_readahead_verify(
struct xfs_buf *bp)
{
xfs_inode_buf_verify(bp, true);
}
static void
xfs_inode_buf_write_verify(
struct xfs_buf *bp)
{
xfs_inode_buf_verify(bp, false);
}
const struct xfs_buf_ops xfs_inode_buf_ops = {
.name = "xfs_inode",
.magic16 = { cpu_to_be16(XFS_DINODE_MAGIC),
cpu_to_be16(XFS_DINODE_MAGIC) },
.verify_read = xfs_inode_buf_read_verify,
.verify_write = xfs_inode_buf_write_verify,
};
const struct xfs_buf_ops xfs_inode_buf_ra_ops = {
.name = "xfs_inode_ra",
.magic16 = { cpu_to_be16(XFS_DINODE_MAGIC),
cpu_to_be16(XFS_DINODE_MAGIC) },
.verify_read = xfs_inode_buf_readahead_verify,
.verify_write = xfs_inode_buf_write_verify,
};
/*
* Read the inode cluster at @bno and return it in @bpp.
*/
int
xfs_read_icluster(
struct xfs_perag *pag,
struct xfs_trans *tp,
xfs_agblock_t agbno,
struct xfs_buf **bpp)
{
struct xfs_mount *mp = pag_mount(pag);
int error;
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
xfs_agbno_to_daddr(pag, agbno),
XFS_FSB_TO_BB(mp, M_IGEO(mp)->blocks_per_cluster),
0, bpp, &xfs_inode_buf_ops);
if (xfs_metadata_is_sick(error))
xfs_agno_mark_sick(mp, pag_agno(pag), XFS_SICK_AG_INODES);
return error;
}
static inline struct timespec64 xfs_inode_decode_bigtime(uint64_t ts)
{
struct timespec64 tv;
uint32_t n;
tv.tv_sec = xfs_bigtime_to_unix(div_u64_rem(ts, NSEC_PER_SEC, &n));
tv.tv_nsec = n;
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_ag.h`.
- Detected declarations: `function xfs_dquot_buf_readahead_verify`, `function xfs_inode_buf_read_verify`, `function xfs_inode_buf_readahead_verify`, `function xfs_inode_buf_write_verify`, `function xfs_read_icluster`, `function xfs_inode_decode_bigtime`, `function xfs_inode_from_disk_ts`, `function xfs_inode_from_disk`, `function xfs_inode_to_disk_ts`, `function xfs_inode_to_disk_iext_counters`.
- 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.