fs/xfs/xfs_inode_item_recover.c
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_inode_item_recover.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_inode_item_recover.c- Extension
.c- Size
- 17776 bytes
- Lines
- 605
- 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.
- 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_log_format.hxfs_trans_resv.hxfs_mount.hxfs_inode.hxfs_trans.hxfs_inode_item.hxfs_trace.hxfs_trans_priv.hxfs_buf_item.hxfs_log.hxfs_error.hxfs_log_priv.hxfs_log_recover.hxfs_icache.hxfs_bmap_btree.hxfs_rtrmap_btree.hxfs_rtrefcount_btree.h
Detected Declarations
function Copyrightfunction xfs_igetfunction xfs_log_dinode_has_bigtimefunction xfs_log_dinode_to_disk_tsfunction xfs_log_dinode_has_large_extent_countsfunction xfs_log_dinode_to_disk_iext_countersfunction xfs_log_dinode_to_diskfunction xlog_dinode_verify_extent_countsfunction xlog_recover_inode_dbrootfunction xlog_recover_inode_commit_pass2
Annotated Snippet
if (ldip->di_version == 3 && ldip->di_v3_pad != 0) {
XFS_CORRUPTION_ERROR(
"Bad log dinode di_v3_pad",
XFS_ERRLEVEL_LOW, mp, ldip, sizeof(*ldip));
xfs_alert(mp,
"Bad inode 0x%llx, di_v3_pad 0x%llx",
ldip->di_ino, ldip->di_v3_pad);
return -EFSCORRUPTED;
}
nextents = ldip->di_nextents;
anextents = ldip->di_anextents;
}
if (unlikely(nextents + anextents > ldip->di_nblocks)) {
XFS_CORRUPTION_ERROR("Bad log dinode extent counts",
XFS_ERRLEVEL_LOW, mp, ldip, sizeof(*ldip));
xfs_alert(mp,
"Bad inode 0x%llx, large extent counts %d, nextents 0x%llx, anextents 0x%x, nblocks 0x%llx",
ldip->di_ino, xfs_has_large_extent_counts(mp), nextents,
anextents, ldip->di_nblocks);
return -EFSCORRUPTED;
}
return 0;
}
static inline int
xlog_recover_inode_dbroot(
struct xfs_mount *mp,
void *src,
unsigned int len,
struct xfs_dinode *dip)
{
void *dfork = XFS_DFORK_DPTR(dip);
unsigned int dsize = XFS_DFORK_DSIZE(dip, mp);
switch (dip->di_format) {
case XFS_DINODE_FMT_BTREE:
xfs_bmbt_to_bmdr(mp, src, len, dfork, dsize);
break;
case XFS_DINODE_FMT_META_BTREE:
switch (be16_to_cpu(dip->di_metatype)) {
case XFS_METAFILE_RTRMAP:
xfs_rtrmapbt_to_disk(mp, src, len, dfork, dsize);
return 0;
case XFS_METAFILE_RTREFCOUNT:
xfs_rtrefcountbt_to_disk(mp, src, len, dfork, dsize);
return 0;
default:
ASSERT(0);
return -EFSCORRUPTED;
}
break;
default:
ASSERT(0);
return -EFSCORRUPTED;
}
return 0;
}
STATIC int
xlog_recover_inode_commit_pass2(
struct xlog *log,
struct list_head *buffer_list,
struct xlog_recover_item *item,
xfs_lsn_t current_lsn)
{
struct xfs_inode_log_format *in_f;
struct xfs_mount *mp = log->l_mp;
struct xfs_buf *bp;
struct xfs_dinode *dip;
int len;
char *src;
char *dest;
int error;
int attr_index;
uint fields;
struct xfs_log_dinode *ldip;
uint isize;
int need_free = 0;
xfs_failaddr_t fa;
if (item->ri_buf[0].iov_len == sizeof(struct xfs_inode_log_format)) {
in_f = item->ri_buf[0].iov_base;
} else {
in_f = kmalloc_obj(struct xfs_inode_log_format,
GFP_KERNEL | __GFP_NOFAIL);
need_free = 1;
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_inode.h`.
- Detected declarations: `function Copyright`, `function xfs_iget`, `function xfs_log_dinode_has_bigtime`, `function xfs_log_dinode_to_disk_ts`, `function xfs_log_dinode_has_large_extent_counts`, `function xfs_log_dinode_to_disk_iext_counters`, `function xfs_log_dinode_to_disk`, `function xlog_dinode_verify_extent_counts`, `function xlog_recover_inode_dbroot`, `function xlog_recover_inode_commit_pass2`.
- 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.