Commit d3537cf9 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: stop using q_core limits in the quota code

Add limits fields in the incore dquot, and use that instead of the ones
in qcore.  This eliminates a bunch of endian conversions and will
eventually allow us to remove qcore entirely.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarChandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAllison Collins <allison.henderson@oracle.com>
parent 784e80f5
...@@ -82,12 +82,6 @@ xchk_quota_item( ...@@ -82,12 +82,6 @@ xchk_quota_item(
struct xfs_disk_dquot *d = &dq->q_core; struct xfs_disk_dquot *d = &dq->q_core;
struct xfs_quotainfo *qi = mp->m_quotainfo; struct xfs_quotainfo *qi = mp->m_quotainfo;
xfs_fileoff_t offset; xfs_fileoff_t offset;
unsigned long long bsoft;
unsigned long long isoft;
unsigned long long rsoft;
unsigned long long bhard;
unsigned long long ihard;
unsigned long long rhard;
unsigned long long bcount; unsigned long long bcount;
unsigned long long icount; unsigned long long icount;
unsigned long long rcount; unsigned long long rcount;
...@@ -114,15 +108,6 @@ xchk_quota_item( ...@@ -114,15 +108,6 @@ xchk_quota_item(
if (d->d_pad0 != cpu_to_be32(0) || d->d_pad != cpu_to_be16(0)) if (d->d_pad0 != cpu_to_be32(0) || d->d_pad != cpu_to_be16(0))
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
/* Check the limits. */
bhard = be64_to_cpu(d->d_blk_hardlimit);
ihard = be64_to_cpu(d->d_ino_hardlimit);
rhard = be64_to_cpu(d->d_rtb_hardlimit);
bsoft = be64_to_cpu(d->d_blk_softlimit);
isoft = be64_to_cpu(d->d_ino_softlimit);
rsoft = be64_to_cpu(d->d_rtb_softlimit);
/* /*
* Warn if the hard limits are larger than the fs. * Warn if the hard limits are larger than the fs.
* Administrators can do this, though in production this seems * Administrators can do this, though in production this seems
...@@ -131,19 +116,19 @@ xchk_quota_item( ...@@ -131,19 +116,19 @@ xchk_quota_item(
* Complain about corruption if the soft limit is greater than * Complain about corruption if the soft limit is greater than
* the hard limit. * the hard limit.
*/ */
if (bhard > mp->m_sb.sb_dblocks) if (dq->q_blk.hardlimit > mp->m_sb.sb_dblocks)
xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset);
if (bsoft > bhard) if (dq->q_blk.softlimit > dq->q_blk.hardlimit)
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
if (ihard > M_IGEO(mp)->maxicount) if (dq->q_ino.hardlimit > M_IGEO(mp)->maxicount)
xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset);
if (isoft > ihard) if (dq->q_ino.softlimit > dq->q_ino.hardlimit)
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
if (rhard > mp->m_sb.sb_rblocks) if (dq->q_rtb.hardlimit > mp->m_sb.sb_rblocks)
xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset);
if (rsoft > rhard) if (dq->q_rtb.softlimit > dq->q_rtb.hardlimit)
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset); xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
/* Check the resource counts. */ /* Check the resource counts. */
...@@ -177,13 +162,16 @@ xchk_quota_item( ...@@ -177,13 +162,16 @@ xchk_quota_item(
if (dq->q_id == 0) if (dq->q_id == 0)
goto out; goto out;
if (bhard != 0 && bcount > bhard) if (dq->q_blk.hardlimit != 0 &&
bcount > dq->q_blk.hardlimit)
xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset);
if (ihard != 0 && icount > ihard) if (dq->q_ino.hardlimit != 0 &&
icount > dq->q_ino.hardlimit)
xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset);
if (rhard != 0 && rcount > rhard) if (dq->q_rtb.hardlimit != 0 &&
rcount > dq->q_rtb.hardlimit)
xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset); xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset);
out: out:
......
...@@ -71,29 +71,28 @@ xfs_qm_adjust_dqlimits( ...@@ -71,29 +71,28 @@ xfs_qm_adjust_dqlimits(
struct xfs_dquot *dq) struct xfs_dquot *dq)
{ {
struct xfs_quotainfo *q = mp->m_quotainfo; struct xfs_quotainfo *q = mp->m_quotainfo;
struct xfs_disk_dquot *d = &dq->q_core;
struct xfs_def_quota *defq; struct xfs_def_quota *defq;
int prealloc = 0; int prealloc = 0;
ASSERT(dq->q_id); ASSERT(dq->q_id);
defq = xfs_get_defquota(q, xfs_dquot_type(dq)); defq = xfs_get_defquota(q, xfs_dquot_type(dq));
if (defq->bsoftlimit && !d->d_blk_softlimit) { if (defq->bsoftlimit && !dq->q_blk.softlimit) {
d->d_blk_softlimit = cpu_to_be64(defq->bsoftlimit); dq->q_blk.softlimit = defq->bsoftlimit;
prealloc = 1; prealloc = 1;
} }
if (defq->bhardlimit && !d->d_blk_hardlimit) { if (defq->bhardlimit && !dq->q_blk.hardlimit) {
d->d_blk_hardlimit = cpu_to_be64(defq->bhardlimit); dq->q_blk.hardlimit = defq->bhardlimit;
prealloc = 1; prealloc = 1;
} }
if (defq->isoftlimit && !d->d_ino_softlimit) if (defq->isoftlimit && !dq->q_ino.softlimit)
d->d_ino_softlimit = cpu_to_be64(defq->isoftlimit); dq->q_ino.softlimit = defq->isoftlimit;
if (defq->ihardlimit && !d->d_ino_hardlimit) if (defq->ihardlimit && !dq->q_ino.hardlimit)
d->d_ino_hardlimit = cpu_to_be64(defq->ihardlimit); dq->q_ino.hardlimit = defq->ihardlimit;
if (defq->rtbsoftlimit && !d->d_rtb_softlimit) if (defq->rtbsoftlimit && !dq->q_rtb.softlimit)
d->d_rtb_softlimit = cpu_to_be64(defq->rtbsoftlimit); dq->q_rtb.softlimit = defq->rtbsoftlimit;
if (defq->rtbhardlimit && !d->d_rtb_hardlimit) if (defq->rtbhardlimit && !dq->q_rtb.hardlimit)
d->d_rtb_hardlimit = cpu_to_be64(defq->rtbhardlimit); dq->q_rtb.hardlimit = defq->rtbhardlimit;
if (prealloc) if (prealloc)
xfs_dquot_set_prealloc_limits(dq); xfs_dquot_set_prealloc_limits(dq);
...@@ -125,82 +124,67 @@ xfs_qm_adjust_dqtimers( ...@@ -125,82 +124,67 @@ xfs_qm_adjust_dqtimers(
defq = xfs_get_defquota(qi, xfs_dquot_type(dq)); defq = xfs_get_defquota(qi, xfs_dquot_type(dq));
#ifdef DEBUG #ifdef DEBUG
if (d->d_blk_hardlimit) if (dq->q_blk.hardlimit)
ASSERT(be64_to_cpu(d->d_blk_softlimit) <= ASSERT(dq->q_blk.softlimit <= dq->q_blk.hardlimit);
be64_to_cpu(d->d_blk_hardlimit)); if (dq->q_ino.hardlimit)
if (d->d_ino_hardlimit) ASSERT(dq->q_ino.softlimit <= dq->q_ino.hardlimit);
ASSERT(be64_to_cpu(d->d_ino_softlimit) <= if (dq->q_rtb.hardlimit)
be64_to_cpu(d->d_ino_hardlimit)); ASSERT(dq->q_rtb.softlimit <= dq->q_rtb.hardlimit);
if (d->d_rtb_hardlimit)
ASSERT(be64_to_cpu(d->d_rtb_softlimit) <=
be64_to_cpu(d->d_rtb_hardlimit));
#endif #endif
if (!d->d_btimer) { if (!d->d_btimer) {
if ((d->d_blk_softlimit && if ((dq->q_blk.softlimit &&
(be64_to_cpu(d->d_bcount) > (be64_to_cpu(d->d_bcount) > dq->q_blk.softlimit)) ||
be64_to_cpu(d->d_blk_softlimit))) || (dq->q_blk.hardlimit &&
(d->d_blk_hardlimit && (be64_to_cpu(d->d_bcount) > dq->q_blk.hardlimit))) {
(be64_to_cpu(d->d_bcount) >
be64_to_cpu(d->d_blk_hardlimit)))) {
d->d_btimer = cpu_to_be32(ktime_get_real_seconds() + d->d_btimer = cpu_to_be32(ktime_get_real_seconds() +
defq->btimelimit); defq->btimelimit);
} else { } else {
d->d_bwarns = 0; d->d_bwarns = 0;
} }
} else { } else {
if ((!d->d_blk_softlimit || if ((!dq->q_blk.softlimit ||
(be64_to_cpu(d->d_bcount) <= (be64_to_cpu(d->d_bcount) <= dq->q_blk.softlimit)) &&
be64_to_cpu(d->d_blk_softlimit))) && (!dq->q_blk.hardlimit ||
(!d->d_blk_hardlimit || (be64_to_cpu(d->d_bcount) <= dq->q_blk.hardlimit))) {
(be64_to_cpu(d->d_bcount) <=
be64_to_cpu(d->d_blk_hardlimit)))) {
d->d_btimer = 0; d->d_btimer = 0;
} }
} }
if (!d->d_itimer) { if (!d->d_itimer) {
if ((d->d_ino_softlimit && if ((dq->q_ino.softlimit &&
(be64_to_cpu(d->d_icount) > (be64_to_cpu(d->d_icount) > dq->q_ino.softlimit)) ||
be64_to_cpu(d->d_ino_softlimit))) || (dq->q_ino.hardlimit &&
(d->d_ino_hardlimit && (be64_to_cpu(d->d_icount) > dq->q_ino.hardlimit))) {
(be64_to_cpu(d->d_icount) >
be64_to_cpu(d->d_ino_hardlimit)))) {
d->d_itimer = cpu_to_be32(ktime_get_real_seconds() + d->d_itimer = cpu_to_be32(ktime_get_real_seconds() +
defq->itimelimit); defq->itimelimit);
} else { } else {
d->d_iwarns = 0; d->d_iwarns = 0;
} }
} else { } else {
if ((!d->d_ino_softlimit || if ((!dq->q_ino.softlimit ||
(be64_to_cpu(d->d_icount) <= (be64_to_cpu(d->d_icount) <= dq->q_ino.softlimit)) &&
be64_to_cpu(d->d_ino_softlimit))) && (!dq->q_ino.hardlimit ||
(!d->d_ino_hardlimit || (be64_to_cpu(d->d_icount) <= dq->q_ino.hardlimit))) {
(be64_to_cpu(d->d_icount) <=
be64_to_cpu(d->d_ino_hardlimit)))) {
d->d_itimer = 0; d->d_itimer = 0;
} }
} }
if (!d->d_rtbtimer) { if (!d->d_rtbtimer) {
if ((d->d_rtb_softlimit && if ((dq->q_rtb.softlimit &&
(be64_to_cpu(d->d_rtbcount) > (be64_to_cpu(d->d_rtbcount) > dq->q_rtb.softlimit)) ||
be64_to_cpu(d->d_rtb_softlimit))) || (dq->q_rtb.hardlimit &&
(d->d_rtb_hardlimit && (be64_to_cpu(d->d_rtbcount) > dq->q_rtb.hardlimit))) {
(be64_to_cpu(d->d_rtbcount) >
be64_to_cpu(d->d_rtb_hardlimit)))) {
d->d_rtbtimer = cpu_to_be32(ktime_get_real_seconds() + d->d_rtbtimer = cpu_to_be32(ktime_get_real_seconds() +
defq->rtbtimelimit); defq->rtbtimelimit);
} else { } else {
d->d_rtbwarns = 0; d->d_rtbwarns = 0;
} }
} else { } else {
if ((!d->d_rtb_softlimit || if ((!dq->q_rtb.softlimit ||
(be64_to_cpu(d->d_rtbcount) <= (be64_to_cpu(d->d_rtbcount) <= dq->q_rtb.softlimit)) &&
be64_to_cpu(d->d_rtb_softlimit))) && (!dq->q_rtb.hardlimit ||
(!d->d_rtb_hardlimit || (be64_to_cpu(d->d_rtbcount) <= dq->q_rtb.hardlimit))) {
(be64_to_cpu(d->d_rtbcount) <=
be64_to_cpu(d->d_rtb_hardlimit)))) {
d->d_rtbtimer = 0; d->d_rtbtimer = 0;
} }
} }
...@@ -291,8 +275,8 @@ xfs_dquot_set_prealloc_limits(struct xfs_dquot *dqp) ...@@ -291,8 +275,8 @@ xfs_dquot_set_prealloc_limits(struct xfs_dquot *dqp)
{ {
uint64_t space; uint64_t space;
dqp->q_prealloc_hi_wmark = be64_to_cpu(dqp->q_core.d_blk_hardlimit); dqp->q_prealloc_hi_wmark = dqp->q_blk.hardlimit;
dqp->q_prealloc_lo_wmark = be64_to_cpu(dqp->q_core.d_blk_softlimit); dqp->q_prealloc_lo_wmark = dqp->q_blk.softlimit;
if (!dqp->q_prealloc_lo_wmark) { if (!dqp->q_prealloc_lo_wmark) {
dqp->q_prealloc_lo_wmark = dqp->q_prealloc_hi_wmark; dqp->q_prealloc_lo_wmark = dqp->q_prealloc_hi_wmark;
do_div(dqp->q_prealloc_lo_wmark, 100); do_div(dqp->q_prealloc_lo_wmark, 100);
...@@ -547,6 +531,12 @@ xfs_dquot_from_disk( ...@@ -547,6 +531,12 @@ xfs_dquot_from_disk(
/* copy everything from disk dquot to the incore dquot */ /* copy everything from disk dquot to the incore dquot */
memcpy(&dqp->q_core, ddqp, sizeof(struct xfs_disk_dquot)); memcpy(&dqp->q_core, ddqp, sizeof(struct xfs_disk_dquot));
dqp->q_blk.hardlimit = be64_to_cpu(ddqp->d_blk_hardlimit);
dqp->q_blk.softlimit = be64_to_cpu(ddqp->d_blk_softlimit);
dqp->q_ino.hardlimit = be64_to_cpu(ddqp->d_ino_hardlimit);
dqp->q_ino.softlimit = be64_to_cpu(ddqp->d_ino_softlimit);
dqp->q_rtb.hardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit);
dqp->q_rtb.softlimit = be64_to_cpu(ddqp->d_rtb_softlimit);
/* /*
* Reservation counters are defined as reservation plus current usage * Reservation counters are defined as reservation plus current usage
...@@ -568,6 +558,12 @@ xfs_dquot_to_disk( ...@@ -568,6 +558,12 @@ xfs_dquot_to_disk(
struct xfs_dquot *dqp) struct xfs_dquot *dqp)
{ {
memcpy(ddqp, &dqp->q_core, sizeof(struct xfs_disk_dquot)); memcpy(ddqp, &dqp->q_core, sizeof(struct xfs_disk_dquot));
ddqp->d_blk_hardlimit = cpu_to_be64(dqp->q_blk.hardlimit);
ddqp->d_blk_softlimit = cpu_to_be64(dqp->q_blk.softlimit);
ddqp->d_ino_hardlimit = cpu_to_be64(dqp->q_ino.hardlimit);
ddqp->d_ino_softlimit = cpu_to_be64(dqp->q_ino.softlimit);
ddqp->d_rtb_hardlimit = cpu_to_be64(dqp->q_rtb.hardlimit);
ddqp->d_rtb_softlimit = cpu_to_be64(dqp->q_rtb.softlimit);
} }
/* Allocate and initialize the dquot buffer for this in-core dquot. */ /* Allocate and initialize the dquot buffer for this in-core dquot. */
...@@ -1129,6 +1125,7 @@ static xfs_failaddr_t ...@@ -1129,6 +1125,7 @@ static xfs_failaddr_t
xfs_qm_dqflush_check( xfs_qm_dqflush_check(
struct xfs_dquot *dqp) struct xfs_dquot *dqp)
{ {
struct xfs_disk_dquot *ddq = &dqp->q_core;
__u8 type = dqp->dq_flags & XFS_DQ_ALLTYPES; __u8 type = dqp->dq_flags & XFS_DQ_ALLTYPES;
if (type != XFS_DQ_USER && if (type != XFS_DQ_USER &&
...@@ -1136,6 +1133,24 @@ xfs_qm_dqflush_check( ...@@ -1136,6 +1133,24 @@ xfs_qm_dqflush_check(
type != XFS_DQ_PROJ) type != XFS_DQ_PROJ)
return __this_address; return __this_address;
if (dqp->q_id == 0)
return NULL;
if (dqp->q_blk.softlimit &&
be64_to_cpu(ddq->d_bcount) > dqp->q_blk.softlimit &&
!ddq->d_btimer)
return __this_address;
if (dqp->q_ino.softlimit &&
be64_to_cpu(ddq->d_icount) > dqp->q_ino.softlimit &&
!ddq->d_itimer)
return __this_address;
if (dqp->q_rtb.softlimit &&
be64_to_cpu(ddq->d_rtbcount) > dqp->q_rtb.softlimit &&
!ddq->d_rtbtimer)
return __this_address;
return NULL; return NULL;
} }
......
...@@ -30,6 +30,10 @@ enum { ...@@ -30,6 +30,10 @@ enum {
struct xfs_dquot_res { struct xfs_dquot_res {
/* Total resources allocated and reserved. */ /* Total resources allocated and reserved. */
xfs_qcnt_t reserved; xfs_qcnt_t reserved;
/* Absolute and preferred limits. */
xfs_qcnt_t hardlimit;
xfs_qcnt_t softlimit;
}; };
/* /*
...@@ -143,7 +147,7 @@ static inline bool xfs_dquot_lowsp(struct xfs_dquot *dqp) ...@@ -143,7 +147,7 @@ static inline bool xfs_dquot_lowsp(struct xfs_dquot *dqp)
{ {
int64_t freesp; int64_t freesp;
freesp = be64_to_cpu(dqp->q_core.d_blk_hardlimit) - dqp->q_blk.reserved; freesp = dqp->q_blk.hardlimit - dqp->q_blk.reserved;
if (freesp < dqp->q_low_space[XFS_QLOWSP_1_PCNT]) if (freesp < dqp->q_low_space[XFS_QLOWSP_1_PCNT])
return true; return true;
......
...@@ -550,26 +550,24 @@ xfs_qm_set_defquota( ...@@ -550,26 +550,24 @@ xfs_qm_set_defquota(
{ {
struct xfs_dquot *dqp; struct xfs_dquot *dqp;
struct xfs_def_quota *defq; struct xfs_def_quota *defq;
struct xfs_disk_dquot *ddqp;
int error; int error;
error = xfs_qm_dqget_uncached(mp, 0, type, &dqp); error = xfs_qm_dqget_uncached(mp, 0, type, &dqp);
if (error) if (error)
return; return;
ddqp = &dqp->q_core;
defq = xfs_get_defquota(qinf, xfs_dquot_type(dqp)); defq = xfs_get_defquota(qinf, xfs_dquot_type(dqp));
/* /*
* Timers and warnings have been already set, let's just set the * Timers and warnings have been already set, let's just set the
* default limits for this quota type * default limits for this quota type
*/ */
defq->bhardlimit = be64_to_cpu(ddqp->d_blk_hardlimit); defq->bhardlimit = dqp->q_blk.hardlimit;
defq->bsoftlimit = be64_to_cpu(ddqp->d_blk_softlimit); defq->bsoftlimit = dqp->q_blk.softlimit;
defq->ihardlimit = be64_to_cpu(ddqp->d_ino_hardlimit); defq->ihardlimit = dqp->q_ino.hardlimit;
defq->isoftlimit = be64_to_cpu(ddqp->d_ino_softlimit); defq->isoftlimit = dqp->q_ino.softlimit;
defq->rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit); defq->rtbhardlimit = dqp->q_rtb.hardlimit;
defq->rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit); defq->rtbsoftlimit = dqp->q_rtb.softlimit;
xfs_qm_dqdestroy(dqp); xfs_qm_dqdestroy(dqp);
} }
......
...@@ -20,12 +20,12 @@ extern struct kmem_zone *xfs_qm_dqtrxzone; ...@@ -20,12 +20,12 @@ extern struct kmem_zone *xfs_qm_dqtrxzone;
#define XFS_DQITER_MAP_SIZE 10 #define XFS_DQITER_MAP_SIZE 10
#define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \ #define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \
!dqp->q_core.d_blk_hardlimit && \ !dqp->q_blk.hardlimit && \
!dqp->q_core.d_blk_softlimit && \ !dqp->q_blk.softlimit && \
!dqp->q_core.d_rtb_hardlimit && \ !dqp->q_rtb.hardlimit && \
!dqp->q_core.d_rtb_softlimit && \ !dqp->q_rtb.softlimit && \
!dqp->q_core.d_ino_hardlimit && \ !dqp->q_ino.hardlimit && \
!dqp->q_core.d_ino_softlimit && \ !dqp->q_ino.softlimit && \
!dqp->q_core.d_bcount && \ !dqp->q_core.d_bcount && \
!dqp->q_core.d_rtbcount && \ !dqp->q_core.d_rtbcount && \
!dqp->q_core.d_icount) !dqp->q_core.d_icount)
......
...@@ -23,9 +23,9 @@ xfs_fill_statvfs_from_dquot( ...@@ -23,9 +23,9 @@ xfs_fill_statvfs_from_dquot(
{ {
uint64_t limit; uint64_t limit;
limit = dqp->q_core.d_blk_softlimit ? limit = dqp->q_blk.softlimit ?
be64_to_cpu(dqp->q_core.d_blk_softlimit) : dqp->q_blk.softlimit :
be64_to_cpu(dqp->q_core.d_blk_hardlimit); dqp->q_blk.hardlimit;
if (limit && statp->f_blocks > limit) { if (limit && statp->f_blocks > limit) {
statp->f_blocks = limit; statp->f_blocks = limit;
statp->f_bfree = statp->f_bavail = statp->f_bfree = statp->f_bavail =
...@@ -33,9 +33,9 @@ xfs_fill_statvfs_from_dquot( ...@@ -33,9 +33,9 @@ xfs_fill_statvfs_from_dquot(
(statp->f_blocks - dqp->q_blk.reserved) : 0; (statp->f_blocks - dqp->q_blk.reserved) : 0;
} }
limit = dqp->q_core.d_ino_softlimit ? limit = dqp->q_ino.softlimit ?
be64_to_cpu(dqp->q_core.d_ino_softlimit) : dqp->q_ino.softlimit :
be64_to_cpu(dqp->q_core.d_ino_hardlimit); dqp->q_ino.hardlimit;
if (limit && statp->f_files > limit) { if (limit && statp->f_files > limit) {
statp->f_files = limit; statp->f_files = limit;
statp->f_ffree = statp->f_ffree =
......
...@@ -495,13 +495,13 @@ xfs_qm_scall_setqlim( ...@@ -495,13 +495,13 @@ xfs_qm_scall_setqlim(
*/ */
hard = (newlim->d_fieldmask & QC_SPC_HARD) ? hard = (newlim->d_fieldmask & QC_SPC_HARD) ?
(xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_hardlimit) : (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_hardlimit) :
be64_to_cpu(ddq->d_blk_hardlimit); dqp->q_blk.hardlimit;
soft = (newlim->d_fieldmask & QC_SPC_SOFT) ? soft = (newlim->d_fieldmask & QC_SPC_SOFT) ?
(xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_softlimit) : (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_softlimit) :
be64_to_cpu(ddq->d_blk_softlimit); dqp->q_blk.softlimit;
if (hard == 0 || hard >= soft) { if (hard == 0 || hard >= soft) {
ddq->d_blk_hardlimit = cpu_to_be64(hard); dqp->q_blk.hardlimit = hard;
ddq->d_blk_softlimit = cpu_to_be64(soft); dqp->q_blk.softlimit = soft;
xfs_dquot_set_prealloc_limits(dqp); xfs_dquot_set_prealloc_limits(dqp);
if (id == 0) { if (id == 0) {
defq->bhardlimit = hard; defq->bhardlimit = hard;
...@@ -512,13 +512,13 @@ xfs_qm_scall_setqlim( ...@@ -512,13 +512,13 @@ xfs_qm_scall_setqlim(
} }
hard = (newlim->d_fieldmask & QC_RT_SPC_HARD) ? hard = (newlim->d_fieldmask & QC_RT_SPC_HARD) ?
(xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_hardlimit) : (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_hardlimit) :
be64_to_cpu(ddq->d_rtb_hardlimit); dqp->q_rtb.hardlimit;
soft = (newlim->d_fieldmask & QC_RT_SPC_SOFT) ? soft = (newlim->d_fieldmask & QC_RT_SPC_SOFT) ?
(xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_softlimit) : (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_softlimit) :
be64_to_cpu(ddq->d_rtb_softlimit); dqp->q_rtb.softlimit;
if (hard == 0 || hard >= soft) { if (hard == 0 || hard >= soft) {
ddq->d_rtb_hardlimit = cpu_to_be64(hard); dqp->q_rtb.hardlimit = hard;
ddq->d_rtb_softlimit = cpu_to_be64(soft); dqp->q_rtb.softlimit = soft;
if (id == 0) { if (id == 0) {
defq->rtbhardlimit = hard; defq->rtbhardlimit = hard;
defq->rtbsoftlimit = soft; defq->rtbsoftlimit = soft;
...@@ -529,13 +529,13 @@ xfs_qm_scall_setqlim( ...@@ -529,13 +529,13 @@ xfs_qm_scall_setqlim(
hard = (newlim->d_fieldmask & QC_INO_HARD) ? hard = (newlim->d_fieldmask & QC_INO_HARD) ?
(xfs_qcnt_t) newlim->d_ino_hardlimit : (xfs_qcnt_t) newlim->d_ino_hardlimit :
be64_to_cpu(ddq->d_ino_hardlimit); dqp->q_ino.hardlimit;
soft = (newlim->d_fieldmask & QC_INO_SOFT) ? soft = (newlim->d_fieldmask & QC_INO_SOFT) ?
(xfs_qcnt_t) newlim->d_ino_softlimit : (xfs_qcnt_t) newlim->d_ino_softlimit :
be64_to_cpu(ddq->d_ino_softlimit); dqp->q_ino.softlimit;
if (hard == 0 || hard >= soft) { if (hard == 0 || hard >= soft) {
ddq->d_ino_hardlimit = cpu_to_be64(hard); dqp->q_ino.hardlimit = hard;
ddq->d_ino_softlimit = cpu_to_be64(soft); dqp->q_ino.softlimit = soft;
if (id == 0) { if (id == 0) {
defq->ihardlimit = hard; defq->ihardlimit = hard;
defq->isoftlimit = soft; defq->isoftlimit = soft;
...@@ -619,10 +619,8 @@ xfs_qm_scall_getquota_fill_qc( ...@@ -619,10 +619,8 @@ xfs_qm_scall_getquota_fill_qc(
struct qc_dqblk *dst) struct qc_dqblk *dst)
{ {
memset(dst, 0, sizeof(*dst)); memset(dst, 0, sizeof(*dst));
dst->d_spc_hardlimit = dst->d_spc_hardlimit = XFS_FSB_TO_B(mp, dqp->q_blk.hardlimit);
XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_blk_hardlimit)); dst->d_spc_softlimit = XFS_FSB_TO_B(mp, dqp->q_blk.softlimit);
dst->d_spc_softlimit =
XFS_FSB_TO_B(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_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_ino_softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
dst->d_space = XFS_FSB_TO_B(mp, dqp->q_blk.reserved); dst->d_space = XFS_FSB_TO_B(mp, dqp->q_blk.reserved);
...@@ -631,10 +629,8 @@ xfs_qm_scall_getquota_fill_qc( ...@@ -631,10 +629,8 @@ xfs_qm_scall_getquota_fill_qc(
dst->d_ino_timer = be32_to_cpu(dqp->q_core.d_itimer); dst->d_ino_timer = be32_to_cpu(dqp->q_core.d_itimer);
dst->d_ino_warns = be16_to_cpu(dqp->q_core.d_iwarns); dst->d_ino_warns = be16_to_cpu(dqp->q_core.d_iwarns);
dst->d_spc_warns = be16_to_cpu(dqp->q_core.d_bwarns); dst->d_spc_warns = be16_to_cpu(dqp->q_core.d_bwarns);
dst->d_rt_spc_hardlimit = dst->d_rt_spc_hardlimit = XFS_FSB_TO_B(mp, dqp->q_rtb.hardlimit);
XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_rtb_hardlimit)); dst->d_rt_spc_softlimit = XFS_FSB_TO_B(mp, dqp->q_rtb.softlimit);
dst->d_rt_spc_softlimit =
XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_rtb_softlimit));
dst->d_rt_space = XFS_FSB_TO_B(mp, dqp->q_rtb.reserved); dst->d_rt_space = XFS_FSB_TO_B(mp, dqp->q_rtb.reserved);
dst->d_rt_spc_timer = be32_to_cpu(dqp->q_core.d_rtbtimer); dst->d_rt_spc_timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
dst->d_rt_spc_warns = be16_to_cpu(dqp->q_core.d_rtbwarns); dst->d_rt_spc_warns = be16_to_cpu(dqp->q_core.d_rtbwarns);
...@@ -664,8 +660,8 @@ xfs_qm_scall_getquota_fill_qc( ...@@ -664,8 +660,8 @@ xfs_qm_scall_getquota_fill_qc(
(dst->d_spc_softlimit > 0)) { (dst->d_spc_softlimit > 0)) {
ASSERT(dst->d_spc_timer != 0); ASSERT(dst->d_spc_timer != 0);
} }
if ((dst->d_ino_count > dst->d_ino_softlimit) && if ((dst->d_ino_count > dqp->q_ino.softlimit) &&
(dst->d_ino_softlimit > 0)) { (dqp->q_ino.softlimit > 0)) {
ASSERT(dst->d_ino_timer != 0); ASSERT(dst->d_ino_timer != 0);
} }
} }
......
...@@ -882,14 +882,10 @@ DECLARE_EVENT_CLASS(xfs_dquot_class, ...@@ -882,14 +882,10 @@ DECLARE_EVENT_CLASS(xfs_dquot_class,
__entry->res_bcount = dqp->q_blk.reserved; __entry->res_bcount = dqp->q_blk.reserved;
__entry->bcount = be64_to_cpu(dqp->q_core.d_bcount); __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
__entry->icount = be64_to_cpu(dqp->q_core.d_icount); __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
__entry->blk_hardlimit = __entry->blk_hardlimit = dqp->q_blk.hardlimit;
be64_to_cpu(dqp->q_core.d_blk_hardlimit); __entry->blk_softlimit = dqp->q_blk.softlimit;
__entry->blk_softlimit = __entry->ino_hardlimit = dqp->q_ino.hardlimit;
be64_to_cpu(dqp->q_core.d_blk_softlimit); __entry->ino_softlimit = dqp->q_ino.softlimit;
__entry->ino_hardlimit =
be64_to_cpu(dqp->q_core.d_ino_hardlimit);
__entry->ino_softlimit =
be64_to_cpu(dqp->q_core.d_ino_softlimit);
), ),
TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx " TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
"bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx " "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
......
...@@ -593,10 +593,10 @@ xfs_trans_dqresv( ...@@ -593,10 +593,10 @@ xfs_trans_dqresv(
defq = xfs_get_defquota(q, xfs_dquot_type(dqp)); defq = xfs_get_defquota(q, xfs_dquot_type(dqp));
if (flags & XFS_TRANS_DQ_RES_BLKS) { if (flags & XFS_TRANS_DQ_RES_BLKS) {
hardlimit = be64_to_cpu(dqp->q_core.d_blk_hardlimit); hardlimit = dqp->q_blk.hardlimit;
if (!hardlimit) if (!hardlimit)
hardlimit = defq->bhardlimit; hardlimit = defq->bhardlimit;
softlimit = be64_to_cpu(dqp->q_core.d_blk_softlimit); softlimit = dqp->q_blk.softlimit;
if (!softlimit) if (!softlimit)
softlimit = defq->bsoftlimit; softlimit = defq->bsoftlimit;
timer = be32_to_cpu(dqp->q_core.d_btimer); timer = be32_to_cpu(dqp->q_core.d_btimer);
...@@ -605,10 +605,10 @@ xfs_trans_dqresv( ...@@ -605,10 +605,10 @@ xfs_trans_dqresv(
resbcountp = &dqp->q_blk.reserved; resbcountp = &dqp->q_blk.reserved;
} else { } else {
ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS); ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
hardlimit = be64_to_cpu(dqp->q_core.d_rtb_hardlimit); hardlimit = dqp->q_rtb.hardlimit;
if (!hardlimit) if (!hardlimit)
hardlimit = defq->rtbhardlimit; hardlimit = defq->rtbhardlimit;
softlimit = be64_to_cpu(dqp->q_core.d_rtb_softlimit); softlimit = dqp->q_rtb.softlimit;
if (!softlimit) if (!softlimit)
softlimit = defq->rtbsoftlimit; softlimit = defq->rtbsoftlimit;
timer = be32_to_cpu(dqp->q_core.d_rtbtimer); timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
...@@ -649,10 +649,10 @@ xfs_trans_dqresv( ...@@ -649,10 +649,10 @@ xfs_trans_dqresv(
timer = be32_to_cpu(dqp->q_core.d_itimer); timer = be32_to_cpu(dqp->q_core.d_itimer);
warns = be16_to_cpu(dqp->q_core.d_iwarns); warns = be16_to_cpu(dqp->q_core.d_iwarns);
warnlimit = defq->iwarnlimit; warnlimit = defq->iwarnlimit;
hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit); hardlimit = dqp->q_ino.hardlimit;
if (!hardlimit) if (!hardlimit)
hardlimit = defq->ihardlimit; hardlimit = defq->ihardlimit;
softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit); softlimit = dqp->q_ino.softlimit;
if (!softlimit) if (!softlimit)
softlimit = defq->isoftlimit; softlimit = defq->isoftlimit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment