fs/xfs/xfs_qm.c
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_qm.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_qm.c- Extension
.c- Size
- 51638 bytes
- Lines
- 2139
- 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_bit.hxfs_sb.hxfs_mount.hxfs_inode.hxfs_iwalk.hxfs_quota.hxfs_bmap.hxfs_bmap_util.hxfs_trans.hxfs_trans_space.hxfs_qm.hxfs_trace.hxfs_icache.hxfs_error.hxfs_ag.hxfs_ialloc.hxfs_log_priv.hxfs_health.hxfs_da_format.hxfs_metafile.hxfs_rtgroup.h
Detected Declarations
struct xfs_qm_isolatefunction xfs_qm_dquot_walkfunction xfs_qm_dqpurgefunction xfs_qm_dqpurge_allfunction xfs_qm_unmountfunction xfs_qm_unmount_rtfunction xfs_qm_destroy_quotainosfunction xfs_qm_unmount_quotasfunction xfs_qm_need_dqattachfunction xfs_qm_dqattach_lockedfunction xfs_qm_dqattachfunction dquotsfunction xfs_qm_dquot_isolatefunction xfs_qm_shrink_scanfunction xfs_qm_shrink_countfunction xfs_qm_set_defquotafunction xfs_qm_init_timelimitsfunction xfs_qm_load_metadir_qinosfunction xfs_qm_create_metadir_qinosfunction xfs_qm_prep_metadir_sbfunction xfs_qm_init_metadir_qinosfunction xfs_qm_init_quotainfofunction xfs_qm_destroy_quotainfofunction xfs_qm_metafile_typefunction xfs_qm_qino_allocfunction xfs_qm_reset_dqcountsfunction xfs_qm_reset_dqcounts_allfunction xfs_qm_reset_dqcountsfunction xfs_qm_reset_dqcounts_buffunction xfs_qm_quotacheck_dqadjustfunction bulkstatfunction thefunction xfs_qm_flush_onefunction xfs_qm_quotacheckfunction xfs_qm_mount_quotasfunction xfs_qm_qino_loadfunction xfs_qm_init_quotainosfunction xfs_qm_dqfree_onefunction dquotfunction dquotfunction xfs_qm_vop_chownfunction xfs_qm_vop_rename_dqattachfunction xfs_qm_vop_create_dqattachfunction xfs_inode_near_dquot_enforcement
Annotated Snippet
struct xfs_qm_isolate {
struct list_head buffers;
struct list_head dispose;
};
static enum lru_status
xfs_qm_dquot_isolate(
struct list_head *item,
struct list_lru_one *lru,
void *arg)
__releases(&lru->lock) __acquires(&lru->lock)
{
struct xfs_dquot *dqp = container_of(item,
struct xfs_dquot, q_lru);
struct xfs_qm_isolate *isol = arg;
enum lru_status ret = LRU_SKIP;
if (!spin_trylock(&dqp->q_lockref.lock))
goto out_miss_busy;
/*
* If something else is freeing this dquot and hasn't yet removed it
* from the LRU, leave it for the freeing task to complete the freeing
* process rather than risk it being free from under us here.
*/
if (__lockref_is_dead(&dqp->q_lockref))
goto out_miss_unlock;
/*
* If the dquot is pinned or dirty, rotate it to the end of the LRU to
* give some time for it to be cleaned before we try to isolate it
* again.
*/
ret = LRU_ROTATE;
if (XFS_DQ_IS_DIRTY(dqp) || atomic_read(&dqp->q_pincount) > 0)
goto out_miss_unlock;
/*
* This dquot has acquired a reference in the meantime remove it from
* the freelist and try again.
*/
if (dqp->q_lockref.count) {
spin_unlock(&dqp->q_lockref.lock);
XFS_STATS_INC(dqp->q_mount, xs_qm_dqwants);
trace_xfs_dqreclaim_want(dqp);
list_lru_isolate(lru, &dqp->q_lru);
XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot_unused);
return LRU_REMOVED;
}
/*
* The dquot may still be under IO, in which case the flush lock will be
* held. If we can't get the flush lock now, just skip over the dquot as
* if it was dirty.
*/
if (!xfs_dqflock_nowait(dqp))
goto out_miss_unlock;
ASSERT(!XFS_DQ_IS_DIRTY(dqp));
xfs_dquot_detach_buf(dqp);
xfs_dqfunlock(dqp);
/*
* Prevent lookups now that we are past the point of no return.
*/
lockref_mark_dead(&dqp->q_lockref);
spin_unlock(&dqp->q_lockref.lock);
list_lru_isolate_move(lru, &dqp->q_lru, &isol->dispose);
XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot_unused);
trace_xfs_dqreclaim_done(dqp);
XFS_STATS_INC(dqp->q_mount, xs_qm_dqreclaims);
return LRU_REMOVED;
out_miss_unlock:
spin_unlock(&dqp->q_lockref.lock);
out_miss_busy:
trace_xfs_dqreclaim_busy(dqp);
XFS_STATS_INC(dqp->q_mount, xs_qm_dqreclaim_misses);
return ret;
}
static unsigned long
xfs_qm_shrink_scan(
struct shrinker *shrink,
struct shrink_control *sc)
{
struct xfs_quotainfo *qi = shrink->private_data;
struct xfs_qm_isolate isol;
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_bit.h`, `xfs_sb.h`.
- Detected declarations: `struct xfs_qm_isolate`, `function xfs_qm_dquot_walk`, `function xfs_qm_dqpurge`, `function xfs_qm_dqpurge_all`, `function xfs_qm_unmount`, `function xfs_qm_unmount_rt`, `function xfs_qm_destroy_quotainos`, `function xfs_qm_unmount_quotas`, `function xfs_qm_need_dqattach`, `function xfs_qm_dqattach_locked`.
- 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.