]> git.karo-electronics.de Git - linux-beck.git/commitdiff
xfs: include reservations in quota reporting
authorChristoph Hellwig <hch@infradead.org>
Mon, 20 Feb 2012 02:28:17 +0000 (02:28 +0000)
committerBen Myers <bpm@sgi.com>
Wed, 29 Feb 2012 20:09:06 +0000 (14:09 -0600)
Report all quota usage including the currently pending reservations.  This
avoids the need to flush delalloc space before gathering quota information,
and matches quota enforcement, which already takes the reservations into
account.

This fixes xfstests 270.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_qm_bhv.c
fs/xfs/xfs_qm_syscalls.c

index a0a829addca9d3c79c649201cf3f9d76432847c1..e4e37877f867a511efb91683ba2bcd66566376f0 100644 (file)
 STATIC void
 xfs_fill_statvfs_from_dquot(
        struct kstatfs          *statp,
-       xfs_disk_dquot_t        *dp)
+       struct xfs_dquot        *dqp)
 {
        __uint64_t              limit;
 
-       limit = dp->d_blk_softlimit ?
-               be64_to_cpu(dp->d_blk_softlimit) :
-               be64_to_cpu(dp->d_blk_hardlimit);
+       limit = dqp->q_core.d_blk_softlimit ?
+               be64_to_cpu(dqp->q_core.d_blk_softlimit) :
+               be64_to_cpu(dqp->q_core.d_blk_hardlimit);
        if (limit && statp->f_blocks > limit) {
                statp->f_blocks = limit;
                statp->f_bfree = statp->f_bavail =
-                       (statp->f_blocks > be64_to_cpu(dp->d_bcount)) ?
-                        (statp->f_blocks - be64_to_cpu(dp->d_bcount)) : 0;
+                       (statp->f_blocks > dqp->q_res_bcount) ?
+                        (statp->f_blocks - dqp->q_res_bcount) : 0;
        }
 
-       limit = dp->d_ino_softlimit ?
-               be64_to_cpu(dp->d_ino_softlimit) :
-               be64_to_cpu(dp->d_ino_hardlimit);
+       limit = dqp->q_core.d_ino_softlimit ?
+               be64_to_cpu(dqp->q_core.d_ino_softlimit) :
+               be64_to_cpu(dqp->q_core.d_ino_hardlimit);
        if (limit && statp->f_files > limit) {
                statp->f_files = limit;
                statp->f_ffree =
-                       (statp->f_files > be64_to_cpu(dp->d_icount)) ?
-                        (statp->f_ffree - be64_to_cpu(dp->d_icount)) : 0;
+                       (statp->f_files > dqp->q_res_icount) ?
+                        (statp->f_ffree - dqp->q_res_icount) : 0;
        }
 }
 
@@ -82,7 +82,7 @@ xfs_qm_statvfs(
        xfs_dquot_t             *dqp;
 
        if (!xfs_qm_dqget(mp, NULL, xfs_get_projid(ip), XFS_DQ_PROJ, 0, &dqp)) {
-               xfs_fill_statvfs_from_dquot(statp, &dqp->q_core);
+               xfs_fill_statvfs_from_dquot(statp, dqp);
                xfs_qm_dqput(dqp);
        }
 }
index 2b85641f33c872ef58a96787ad481791e40a25c4..b9ac268a2d7c6881532834703de78bfc15c92971 100644 (file)
@@ -758,8 +758,8 @@ xfs_qm_scall_getquota(
                XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_blk_softlimit));
        dst->d_ino_hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
        dst->d_ino_softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
-       dst->d_bcount = XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_bcount));
-       dst->d_icount = be64_to_cpu(dqp->q_core.d_icount);
+       dst->d_bcount = XFS_FSB_TO_BB(mp, dqp->q_res_bcount);
+       dst->d_icount = dqp->q_res_icount;
        dst->d_btimer = be32_to_cpu(dqp->q_core.d_btimer);
        dst->d_itimer = be32_to_cpu(dqp->q_core.d_itimer);
        dst->d_iwarns = be16_to_cpu(dqp->q_core.d_iwarns);
@@ -768,7 +768,7 @@ xfs_qm_scall_getquota(
                XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_hardlimit));
        dst->d_rtb_softlimit =
                XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_softlimit));
-       dst->d_rtbcount = XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtbcount));
+       dst->d_rtbcount = XFS_FSB_TO_BB(mp, dqp->q_res_rtbcount);
        dst->d_rtbtimer = be32_to_cpu(dqp->q_core.d_rtbtimer);
        dst->d_rtbwarns = be16_to_cpu(dqp->q_core.d_rtbwarns);