aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dquot.h
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-07-14 10:37:30 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2020-07-28 20:24:14 -0700
commit784e80f5640db9a925af1143a25e9bb98624350d (patch)
treedf84e90d560fd643d4f02d43cb5002f28bbcf15e /fs/xfs/xfs_dquot.h
parentxfs: stop using q_core.d_id in the quota code (diff)
downloadlinux-dev-784e80f5640db9a925af1143a25e9bb98624350d.tar.xz
linux-dev-784e80f5640db9a925af1143a25e9bb98624350d.zip
xfs: use a per-resource struct for incore dquot data
Introduce a new struct xfs_dquot_res that we'll use to track all the incore data for a particular resource type (block, inode, rt block). This will help us (once we've eliminated q_core) to declutter quota functions that currently open-code field access or pass around fields around explicitly. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_dquot.h')
-rw-r--r--fs/xfs/xfs_dquot.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h
index 41664a1fc073..c2f841ed2661 100644
--- a/fs/xfs/xfs_dquot.h
+++ b/fs/xfs/xfs_dquot.h
@@ -27,6 +27,11 @@ enum {
XFS_QLOWSP_MAX
};
+struct xfs_dquot_res {
+ /* Total resources allocated and reserved. */
+ xfs_qcnt_t reserved;
+};
+
/*
* The incore dquot structure
*/
@@ -41,14 +46,13 @@ struct xfs_dquot {
xfs_daddr_t q_blkno;
xfs_fileoff_t q_fileoffset;
+ struct xfs_dquot_res q_blk; /* regular blocks */
+ struct xfs_dquot_res q_ino; /* inodes */
+ struct xfs_dquot_res q_rtb; /* realtime blocks */
+
struct xfs_disk_dquot q_core;
struct xfs_dq_logitem q_logitem;
- /* total regular nblks used+reserved */
- xfs_qcnt_t q_res_bcount;
- /* total inos allocd+reserved */
- xfs_qcnt_t q_res_icount;
- /* total realtime blks used+reserved */
- xfs_qcnt_t q_res_rtbcount;
+
xfs_qcnt_t q_prealloc_lo_wmark;
xfs_qcnt_t q_prealloc_hi_wmark;
int64_t q_low_space[XFS_QLOWSP_MAX];
@@ -139,7 +143,7 @@ static inline bool xfs_dquot_lowsp(struct xfs_dquot *dqp)
{
int64_t freesp;
- freesp = be64_to_cpu(dqp->q_core.d_blk_hardlimit) - dqp->q_res_bcount;
+ freesp = be64_to_cpu(dqp->q_core.d_blk_hardlimit) - dqp->q_blk.reserved;
if (freesp < dqp->q_low_space[XFS_QLOWSP_1_PCNT])
return true;