Skip to content

Commit 9a17ebf

Browse files
author
Darrick J. Wong
committed
xfs: report realtime block quota limits on realtime directories
On the data device, calling statvfs on a projinherit directory results in the block and avail counts being curtailed to the project quota block limits, if any are set. Do the same for realtime files or directories, only use the project quota rt block limits. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent 184c619 commit 9a17ebf

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

fs/xfs/xfs_qm_bhv.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,24 @@
1919
STATIC void
2020
xfs_fill_statvfs_from_dquot(
2121
struct kstatfs *statp,
22+
struct xfs_inode *ip,
2223
struct xfs_dquot *dqp)
2324
{
25+
struct xfs_dquot_res *blkres = &dqp->q_blk;
2426
uint64_t limit;
2527

26-
limit = dqp->q_blk.softlimit ?
27-
dqp->q_blk.softlimit :
28-
dqp->q_blk.hardlimit;
28+
if (XFS_IS_REALTIME_MOUNT(ip->i_mount) &&
29+
(ip->i_diflags & (XFS_DIFLAG_RTINHERIT | XFS_DIFLAG_REALTIME)))
30+
blkres = &dqp->q_rtb;
31+
32+
limit = blkres->softlimit ?
33+
blkres->softlimit :
34+
blkres->hardlimit;
2935
if (limit && statp->f_blocks > limit) {
3036
statp->f_blocks = limit;
3137
statp->f_bfree = statp->f_bavail =
32-
(statp->f_blocks > dqp->q_blk.reserved) ?
33-
(statp->f_blocks - dqp->q_blk.reserved) : 0;
38+
(statp->f_blocks > blkres->reserved) ?
39+
(statp->f_blocks - blkres->reserved) : 0;
3440
}
3541

3642
limit = dqp->q_ino.softlimit ?
@@ -61,7 +67,7 @@ xfs_qm_statvfs(
6167
struct xfs_dquot *dqp;
6268

6369
if (!xfs_qm_dqget(mp, ip->i_projid, XFS_DQTYPE_PROJ, false, &dqp)) {
64-
xfs_fill_statvfs_from_dquot(statp, dqp);
70+
xfs_fill_statvfs_from_dquot(statp, ip, dqp);
6571
xfs_qm_dqput(dqp);
6672
}
6773
}

fs/xfs/xfs_super.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -877,12 +877,6 @@ xfs_fs_statfs(
877877
ffree = statp->f_files - (icount - ifree);
878878
statp->f_ffree = max_t(int64_t, ffree, 0);
879879

880-
881-
if ((ip->i_diflags & XFS_DIFLAG_PROJINHERIT) &&
882-
((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) ==
883-
(XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))
884-
xfs_qm_statvfs(ip, statp);
885-
886880
if (XFS_IS_REALTIME_MOUNT(mp) &&
887881
(ip->i_diflags & (XFS_DIFLAG_RTINHERIT | XFS_DIFLAG_REALTIME))) {
888882
s64 freertx;
@@ -893,6 +887,11 @@ xfs_fs_statfs(
893887
xfs_rtbxlen_to_blen(mp, freertx);
894888
}
895889

890+
if ((ip->i_diflags & XFS_DIFLAG_PROJINHERIT) &&
891+
((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) ==
892+
(XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))
893+
xfs_qm_statvfs(ip, statp);
894+
896895
return 0;
897896
}
898897

0 commit comments

Comments
 (0)