fs/xfs/xfs_qm_syscalls.c
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_qm_syscalls.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_qm_syscalls.c- Extension
.c- Size
- 13868 bytes
- Lines
- 547
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: syscall or user/kernel boundary
- Status
- core 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 participates in a user/kernel boundary; inspect argument validation, copy_from_user/copy_to_user, credentials, and dispatch target.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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_sb.hxfs_mount.hxfs_inode.hxfs_trans.hxfs_quota.hxfs_qm.hxfs_icache.h
Detected Declarations
function Copyrightfunction xfs_qm_scall_trunc_qfilefunction xfs_qm_scall_trunc_qfilesfunction onfunction xfs_setqlim_limitsfunction xfs_setqlim_timerfunction xfs_qm_scall_setqlimfunction xfs_qm_scall_getquota_fill_defaultsfunction xfs_qm_scall_getquota_fill_qcfunction xfs_qm_scall_getquotafunction xfs_qm_scall_getquota_next
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*/
#include "xfs_platform.h"
#include "xfs_fs.h"
#include "xfs_shared.h"
#include "xfs_format.h"
#include "xfs_log_format.h"
#include "xfs_trans_resv.h"
#include "xfs_sb.h"
#include "xfs_mount.h"
#include "xfs_inode.h"
#include "xfs_trans.h"
#include "xfs_quota.h"
#include "xfs_qm.h"
#include "xfs_icache.h"
int
xfs_qm_scall_quotaoff(
xfs_mount_t *mp,
uint flags)
{
/*
* No file system can have quotas enabled on disk but not in core.
* Note that quota utilities (like quotaoff) _expect_
* errno == -EEXIST here.
*/
if ((mp->m_qflags & flags) == 0)
return -EEXIST;
/*
* We do not support actually turning off quota accounting any more.
* Just log a warning and ignore the accounting related flags.
*/
if (flags & XFS_ALL_QUOTA_ACCT)
xfs_info(mp, "disabling of quota accounting not supported.");
mutex_lock(&mp->m_quotainfo->qi_quotaofflock);
mp->m_qflags &= ~(flags & XFS_ALL_QUOTA_ENFD);
spin_lock(&mp->m_sb_lock);
mp->m_sb.sb_qflags = mp->m_qflags;
spin_unlock(&mp->m_sb_lock);
mutex_unlock(&mp->m_quotainfo->qi_quotaofflock);
/* XXX what to do if error ? Revert back to old vals incore ? */
return xfs_sync_sb(mp, false);
}
STATIC int
xfs_qm_scall_trunc_qfile(
struct xfs_mount *mp,
xfs_dqtype_t type)
{
struct xfs_inode *ip;
struct xfs_trans *tp;
int error;
error = xfs_qm_qino_load(mp, type, &ip);
if (error == -ENOENT)
return 0;
if (error)
return error;
xfs_ilock(ip, XFS_IOLOCK_EXCL);
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
if (error) {
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
goto out_put;
}
xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, 0);
ip->i_disk_size = 0;
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
error = xfs_itruncate_extents(&tp, ip, XFS_DATA_FORK, 0);
if (error) {
xfs_trans_cancel(tp);
goto out_unlock;
}
ASSERT(ip->i_df.if_nextents == 0);
xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
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_sb.h`, `xfs_mount.h`.
- Detected declarations: `function Copyright`, `function xfs_qm_scall_trunc_qfile`, `function xfs_qm_scall_trunc_qfiles`, `function on`, `function xfs_setqlim_limits`, `function xfs_setqlim_timer`, `function xfs_qm_scall_setqlim`, `function xfs_qm_scall_getquota_fill_defaults`, `function xfs_qm_scall_getquota_fill_qc`, `function xfs_qm_scall_getquota`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: core 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.