fs/xfs/xfs_inode_item.c
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_inode_item.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_inode_item.c- Extension
.c- Size
- 36647 bytes
- Lines
- 1248
- 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_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_log_priv.hxfs_ag.hxfs_error.hxfs_rtbitmap.hlinux/iversion.h
Detected Declarations
function xfs_inode_item_sortfunction xfs_inode_item_precommit_checkfunction xfs_trans_log_inodefunction xfs_has_bigtimefunction forkfunction xfs_inode_item_attr_fork_sizefunction xfs_inode_item_sizefunction xfs_inode_item_format_data_forkfunction xfs_inode_item_format_attr_forkfunction xfs_inode_to_log_dinode_tsfunction xfs_copy_dm_fields_to_log_dinodefunction xfs_inode_to_log_dinode_iext_countersfunction xfs_inode_to_log_dinodefunction xfs_inode_item_format_corefunction xfs_inode_item_formatfunction xfs_inode_item_pinfunction xfs_inode_item_pinfunction xfs_inode_item_pushfunction xfs_inode_item_releasefunction xfs_inode_freefunction numberfunction allocatedfunction xfs_inode_item_destroyfunction xfs_iflush_ail_updatesfunction xfs_iflush_finishfunction list_for_each_entry_safefunction xfs_buf_inode_iodonefunction xfs_iflush_abort_cleanfunction freedfunction xfs_iflush_shutdown_abortfunction xfs_inode_item_format_convert
Annotated Snippet
xfs_has_bigtime(mp) && !xfs_inode_has_bigtime(ip)) {
ip->i_diflags2 |= XFS_DIFLAG2_BIGTIME;
flags |= XFS_ILOG_CORE;
}
/*
* Inode verifiers do not check that the extent size hints are an
* integer multiple of the rt extent size on a directory with
* rtinherit flags set. If we're logging a directory that is
* misconfigured in this way, clear the bad hints.
*/
if (ip->i_diflags & XFS_DIFLAG_RTINHERIT) {
if ((ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT) &&
xfs_extlen_to_rtxmod(mp, ip->i_extsize) > 0) {
ip->i_diflags &= ~(XFS_DIFLAG_EXTSIZE |
XFS_DIFLAG_EXTSZINHERIT);
ip->i_extsize = 0;
flags |= XFS_ILOG_CORE;
}
if ((ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE) &&
xfs_extlen_to_rtxmod(mp, ip->i_cowextsize) > 0) {
ip->i_diflags2 &= ~XFS_DIFLAG2_COWEXTSIZE;
ip->i_cowextsize = 0;
flags |= XFS_ILOG_CORE;
}
}
spin_lock(&iip->ili_lock);
if (!iip->ili_item.li_buf) {
struct xfs_perag *pag;
struct xfs_buf *bp;
int error;
/*
* We hold the ILOCK here, so this inode is not going to be
* flushed while we are here. Further, because there is no
* buffer attached to the item, we know that there is no IO in
* progress, so nothing will clear the ili_fields while we read
* in the buffer. Hence we can safely drop the spin lock and
* read the buffer knowing that the state will not change from
* here.
*/
spin_unlock(&iip->ili_lock);
pag = xfs_perag_get(mp, XFS_INODE_TO_AGNO(ip));
error = xfs_read_icluster(pag, tp, ip->i_imap.im_agbno, &bp);
xfs_perag_put(pag);
if (error)
return error;
/*
* We need an explicit buffer reference for the log item but
* don't want the buffer to remain attached to the transaction.
* Hold the buffer but release the transaction reference once
* we've attached the inode log item to the buffer log item
* list.
*/
xfs_buf_hold(bp);
spin_lock(&iip->ili_lock);
iip->ili_item.li_buf = bp;
bp->b_iodone = xfs_buf_inode_iodone;
list_add_tail(&iip->ili_item.li_bio_list, &bp->b_li_list);
xfs_trans_brelse(tp, bp);
}
/*
* Store the dirty flags back into the inode item as this state is used
* later on in xfs_inode_item_committing() to determine whether the
* transaction is relevant to fsync state or not.
*/
iip->ili_dirty_flags = flags;
/*
* Convert the flags on-disk fields that have been modified in the
* transaction so that ili_fields tracks the changes correctly.
*/
if (flags & XFS_ILOG_IVERSION)
flags = ((flags & ~XFS_ILOG_IVERSION) | XFS_ILOG_CORE);
/*
* Always OR in the bits from the ili_last_fields field. This is to
* coordinate with the xfs_iflush() and xfs_buf_inode_iodone() routines
* in the eventual clearing of the ili_fields bits. See the big comment
* in xfs_iflush() for an explanation of this coordination mechanism.
*/
iip->ili_fields |= (flags | iip->ili_last_fields);
spin_unlock(&iip->ili_lock);
xfs_inode_item_precommit_check(ip);
return 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_inode.h`.
- Detected declarations: `function xfs_inode_item_sort`, `function xfs_inode_item_precommit_check`, `function xfs_trans_log_inode`, `function xfs_has_bigtime`, `function fork`, `function xfs_inode_item_attr_fork_size`, `function xfs_inode_item_size`, `function xfs_inode_item_format_data_fork`, `function xfs_inode_item_format_attr_fork`, `function xfs_inode_to_log_dinode_ts`.
- 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.