fs/xfs/xfs_quotaops.c
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_quotaops.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_quotaops.c- Extension
.c- Size
- 6456 bytes
- Lines
- 290
- 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_shared.hxfs_format.hxfs_log_format.hxfs_trans_resv.hxfs_mount.hxfs_inode.hxfs_quota.hxfs_trans.hxfs_icache.hxfs_qm.h
Detected Declarations
function Copyrightfunction xfs_fs_get_quota_statefunction xfs_quota_typefunction xfs_fs_set_infofunction xfs_quota_flagsfunction xfs_quota_enablefunction xfs_quota_disablefunction xfs_fs_rm_xquotafunction xfs_fs_get_dqblkfunction xfs_fs_get_nextdqblkfunction xfs_fs_set_dqblk
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2008, Christoph Hellwig
* All Rights Reserved.
*/
#include "xfs_platform.h"
#include "xfs_shared.h"
#include "xfs_format.h"
#include "xfs_log_format.h"
#include "xfs_trans_resv.h"
#include "xfs_mount.h"
#include "xfs_inode.h"
#include "xfs_quota.h"
#include "xfs_trans.h"
#include "xfs_icache.h"
#include "xfs_qm.h"
static int
xfs_qm_fill_state(
struct qc_type_state *tstate,
struct xfs_mount *mp,
xfs_dqtype_t type)
{
struct xfs_inode *ip;
struct xfs_def_quota *defq;
int error;
error = xfs_qm_qino_load(mp, type, &ip);
if (error) {
tstate->ino = NULLFSINO;
return error != -ENOENT ? error : 0;
}
defq = xfs_get_defquota(mp->m_quotainfo, type);
tstate->ino = I_INO(ip);
tstate->flags |= QCI_SYSFILE;
tstate->blocks = ip->i_nblocks;
tstate->nextents = ip->i_df.if_nextents;
tstate->spc_timelimit = (u32)defq->blk.time;
tstate->ino_timelimit = (u32)defq->ino.time;
tstate->rt_spc_timelimit = (u32)defq->rtb.time;
tstate->spc_warnlimit = 0;
tstate->ino_warnlimit = 0;
tstate->rt_spc_warnlimit = 0;
xfs_irele(ip);
return 0;
}
/*
* Return quota status information, such as enforcements, quota file inode
* numbers etc.
*/
static int
xfs_fs_get_quota_state(
struct super_block *sb,
struct qc_state *state)
{
struct xfs_mount *mp = XFS_M(sb);
struct xfs_quotainfo *q = mp->m_quotainfo;
int error;
memset(state, 0, sizeof(*state));
if (!XFS_IS_QUOTA_ON(mp))
return 0;
state->s_incoredqs = min_t(uint64_t, q->qi_dquots, UINT_MAX);
if (XFS_IS_UQUOTA_ON(mp))
state->s_state[USRQUOTA].flags |= QCI_ACCT_ENABLED;
if (XFS_IS_UQUOTA_ENFORCED(mp))
state->s_state[USRQUOTA].flags |= QCI_LIMITS_ENFORCED;
if (XFS_IS_GQUOTA_ON(mp))
state->s_state[GRPQUOTA].flags |= QCI_ACCT_ENABLED;
if (XFS_IS_GQUOTA_ENFORCED(mp))
state->s_state[GRPQUOTA].flags |= QCI_LIMITS_ENFORCED;
if (XFS_IS_PQUOTA_ON(mp))
state->s_state[PRJQUOTA].flags |= QCI_ACCT_ENABLED;
if (XFS_IS_PQUOTA_ENFORCED(mp))
state->s_state[PRJQUOTA].flags |= QCI_LIMITS_ENFORCED;
error = xfs_qm_fill_state(&state->s_state[USRQUOTA], mp,
XFS_DQTYPE_USER);
if (error)
return error;
error = xfs_qm_fill_state(&state->s_state[GRPQUOTA], mp,
XFS_DQTYPE_GROUP);
if (error)
return error;
error = xfs_qm_fill_state(&state->s_state[PRJQUOTA], mp,
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_shared.h`, `xfs_format.h`, `xfs_log_format.h`, `xfs_trans_resv.h`, `xfs_mount.h`, `xfs_inode.h`, `xfs_quota.h`.
- Detected declarations: `function Copyright`, `function xfs_fs_get_quota_state`, `function xfs_quota_type`, `function xfs_fs_set_info`, `function xfs_quota_flags`, `function xfs_quota_enable`, `function xfs_quota_disable`, `function xfs_fs_rm_xquota`, `function xfs_fs_get_dqblk`, `function xfs_fs_get_nextdqblk`.
- 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.