// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2000-2005 Silicon Graphics, Inc. * All Rights Reserved.
*/ #ifndef __XFS_DQUOT_H__ #define __XFS_DQUOT_H__
/* * Dquots are structures that hold quota information about a user or a group, * much like inodes are for files. In fact, dquots share many characteristics * with inodes. However, dquots can also be a centralized resource, relative * to a collection of inodes. In this respect, dquots share some characteristics * of the superblock. * XFS dquots exploit both those in its algorithms. They make every attempt * to not be a bottleneck when quotas are on and have minimal impact, if any, * when quotas are off.
*/
struct xfs_dquot_res { /* Total resources allocated and reserved. */
xfs_qcnt_t reserved;
/* Total resources allocated. */
xfs_qcnt_t count;
/* Absolute and preferred limits. */
xfs_qcnt_t hardlimit;
xfs_qcnt_t softlimit;
/* * For root dquots, this is the default grace period, in seconds. * Otherwise, this is when the quota grace period expires, * in seconds since the Unix epoch.
*/
time64_t timer;
};
/* * Lock hierarchy for q_qlock: * XFS_QLOCK_NORMAL is the implicit default, * XFS_QLOCK_NESTED is the dquot with the higher id in xfs_dqlock2
*/ enum {
XFS_QLOCK_NORMAL = 0,
XFS_QLOCK_NESTED,
};
/* * Manage the q_flush completion queue embedded in the dquot. This completion * queue synchronizes processes attempting to flush the in-core dquot back to * disk.
*/ staticinlinevoid xfs_dqflock(struct xfs_dquot *dqp)
{
wait_for_completion(&dqp->q_flush);
}
switch (type) { case XFS_DQTYPE_USER: return ip->i_udquot; case XFS_DQTYPE_GROUP: return ip->i_gdquot; case XFS_DQTYPE_PROJ: return ip->i_pdquot; default: return NULL;
}
}
/* Decide if the dquot's limits are actually being enforced. */ staticinlinebool
xfs_dquot_is_enforced( conststruct xfs_dquot *dqp)
{ switch (xfs_dquot_type(dqp)) { case XFS_DQTYPE_USER: return XFS_IS_UQUOTA_ENFORCED(dqp->q_mount); case XFS_DQTYPE_GROUP: return XFS_IS_GQUOTA_ENFORCED(dqp->q_mount); case XFS_DQTYPE_PROJ: return XFS_IS_PQUOTA_ENFORCED(dqp->q_mount);
}
ASSERT(0); returnfalse;
}
/* * Check whether a dquot is under low free space conditions. We assume the quota * is enabled and enforced.
*/ staticinlinebool xfs_dquot_lowsp(struct xfs_dquot *dqp)
{
int64_t freesp;
freesp = dqp->q_blk.hardlimit - dqp->q_blk.reserved; if (freesp < dqp->q_blk_prealloc.q_low_space[XFS_QLOWSP_1_PCNT]) returntrue;
freesp = dqp->q_rtb.hardlimit - dqp->q_rtb.reserved; if (freesp < dqp->q_rtb_prealloc.q_low_space[XFS_QLOWSP_1_PCNT]) returntrue;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.