Commit efd8f0e6f6c1faa041f228d7113bd3a9db802d49

Authored by Christoph Hellwig
Committed by Jan Kara
1 parent 871a293155

quota: stop using QUOTA_OK / NO_QUOTA

Just use 0 / -EDQUOT directly - that's what it translates to anyway.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>

Showing 2 changed files with 24 additions and 27 deletions Side-by-side Diff

... ... @@ -1181,13 +1181,13 @@
1181 1181 *warntype = QUOTA_NL_NOWARN;
1182 1182 if (!sb_has_quota_limits_enabled(dquot->dq_sb, dquot->dq_type) ||
1183 1183 test_bit(DQ_FAKE_B, &dquot->dq_flags))
1184   - return QUOTA_OK;
  1184 + return 0;
1185 1185  
1186 1186 if (dquot->dq_dqb.dqb_ihardlimit &&
1187 1187 newinodes > dquot->dq_dqb.dqb_ihardlimit &&
1188 1188 !ignore_hardlimit(dquot)) {
1189 1189 *warntype = QUOTA_NL_IHARDWARN;
1190   - return NO_QUOTA;
  1190 + return -EDQUOT;
1191 1191 }
1192 1192  
1193 1193 if (dquot->dq_dqb.dqb_isoftlimit &&
... ... @@ -1196,7 +1196,7 @@
1196 1196 get_seconds() >= dquot->dq_dqb.dqb_itime &&
1197 1197 !ignore_hardlimit(dquot)) {
1198 1198 *warntype = QUOTA_NL_ISOFTLONGWARN;
1199   - return NO_QUOTA;
  1199 + return -EDQUOT;
1200 1200 }
1201 1201  
1202 1202 if (dquot->dq_dqb.dqb_isoftlimit &&
... ... @@ -1207,7 +1207,7 @@
1207 1207 sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace;
1208 1208 }
1209 1209  
1210   - return QUOTA_OK;
  1210 + return 0;
1211 1211 }
1212 1212  
1213 1213 /* needs dq_data_lock */
... ... @@ -1219,7 +1219,7 @@
1219 1219 *warntype = QUOTA_NL_NOWARN;
1220 1220 if (!sb_has_quota_limits_enabled(sb, dquot->dq_type) ||
1221 1221 test_bit(DQ_FAKE_B, &dquot->dq_flags))
1222   - return QUOTA_OK;
  1222 + return 0;
1223 1223  
1224 1224 tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace
1225 1225 + space;
... ... @@ -1229,7 +1229,7 @@
1229 1229 !ignore_hardlimit(dquot)) {
1230 1230 if (!prealloc)
1231 1231 *warntype = QUOTA_NL_BHARDWARN;
1232   - return NO_QUOTA;
  1232 + return -EDQUOT;
1233 1233 }
1234 1234  
1235 1235 if (dquot->dq_dqb.dqb_bsoftlimit &&
... ... @@ -1239,7 +1239,7 @@
1239 1239 !ignore_hardlimit(dquot)) {
1240 1240 if (!prealloc)
1241 1241 *warntype = QUOTA_NL_BSOFTLONGWARN;
1242   - return NO_QUOTA;
  1242 + return -EDQUOT;
1243 1243 }
1244 1244  
1245 1245 if (dquot->dq_dqb.dqb_bsoftlimit &&
1246 1246  
... ... @@ -1255,10 +1255,10 @@
1255 1255 * We don't allow preallocation to exceed softlimit so exceeding will
1256 1256 * be always printed
1257 1257 */
1258   - return NO_QUOTA;
  1258 + return -EDQUOT;
1259 1259 }
1260 1260  
1261   - return QUOTA_OK;
  1261 + return 0;
1262 1262 }
1263 1263  
1264 1264 static int info_idq_free(struct dquot *dquot, qsize_t inodes)
... ... @@ -1507,9 +1507,9 @@
1507 1507 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1508 1508 if (!inode->i_dquot[cnt])
1509 1509 continue;
1510   - if (check_bdq(inode->i_dquot[cnt], number, !warn, warntype+cnt)
1511   - == NO_QUOTA) {
1512   - ret = -EDQUOT;
  1510 + ret = check_bdq(inode->i_dquot[cnt], number, !warn,
  1511 + warntype+cnt);
  1512 + if (ret) {
1513 1513 spin_unlock(&dq_data_lock);
1514 1514 goto out_flush_warn;
1515 1515 }
... ... @@ -1541,7 +1541,7 @@
1541 1541 */
1542 1542 int dquot_alloc_inode(const struct inode *inode)
1543 1543 {
1544   - int cnt, ret = -EDQUOT;
  1544 + int cnt, ret = 0;
1545 1545 char warntype[MAXQUOTAS];
1546 1546  
1547 1547 /* First test before acquiring mutex - solves deadlocks when we
... ... @@ -1555,8 +1555,8 @@
1555 1555 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1556 1556 if (!inode->i_dquot[cnt])
1557 1557 continue;
1558   - if (check_idq(inode->i_dquot[cnt], 1, warntype+cnt)
1559   - == NO_QUOTA)
  1558 + ret = check_idq(inode->i_dquot[cnt], 1, warntype + cnt);
  1559 + if (ret)
1560 1560 goto warn_put_all;
1561 1561 }
1562 1562  
... ... @@ -1565,7 +1565,7 @@
1565 1565 continue;
1566 1566 dquot_incr_inodes(inode->i_dquot[cnt], 1);
1567 1567 }
1568   - ret = 0;
  1568 +
1569 1569 warn_put_all:
1570 1570 spin_unlock(&dq_data_lock);
1571 1571 if (ret == 0)
1572 1572  
... ... @@ -1683,14 +1683,14 @@
1683 1683 qsize_t rsv_space = 0;
1684 1684 struct dquot *transfer_from[MAXQUOTAS];
1685 1685 struct dquot *transfer_to[MAXQUOTAS];
1686   - int cnt, ret = QUOTA_OK;
  1686 + int cnt, ret = 0;
1687 1687 char warntype_to[MAXQUOTAS];
1688 1688 char warntype_from_inodes[MAXQUOTAS], warntype_from_space[MAXQUOTAS];
1689 1689  
1690 1690 /* First test before acquiring mutex - solves deadlocks when we
1691 1691 * re-enter the quota code and are already holding the mutex */
1692 1692 if (IS_NOQUOTA(inode))
1693   - return QUOTA_OK;
  1693 + return 0;
1694 1694 /* Initialize the arrays */
1695 1695 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1696 1696 transfer_from[cnt] = NULL;
1697 1697  
... ... @@ -1715,10 +1715,12 @@
1715 1715 if (!transfer_to[cnt])
1716 1716 continue;
1717 1717 transfer_from[cnt] = inode->i_dquot[cnt];
1718   - if (check_idq(transfer_to[cnt], 1, warntype_to + cnt) ==
1719   - NO_QUOTA || check_bdq(transfer_to[cnt], space, 0,
1720   - warntype_to + cnt) == NO_QUOTA)
  1718 + ret = check_idq(transfer_to[cnt], 1, warntype_to + cnt);
  1719 + if (ret)
1721 1720 goto over_quota;
  1721 + ret = check_bdq(transfer_to[cnt], space, 0, warntype_to + cnt);
  1722 + if (ret)
  1723 + goto over_quota;
1722 1724 }
1723 1725  
1724 1726 /*
... ... @@ -1771,7 +1773,6 @@
1771 1773 /* Clear dquot pointers we don't want to dqput() */
1772 1774 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1773 1775 transfer_from[cnt] = NULL;
1774   - ret = NO_QUOTA;
1775 1776 goto warn_put_all;
1776 1777 }
1777 1778  
... ... @@ -1793,8 +1794,7 @@
1793 1794 }
1794 1795 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) {
1795 1796 dquot_initialize(inode);
1796   - if (__dquot_transfer(inode, chid, mask) == NO_QUOTA)
1797   - return -EDQUOT;
  1797 + return __dquot_transfer(inode, chid, mask);
1798 1798 }
1799 1799 return 0;
1800 1800 }
include/linux/quota.h
... ... @@ -279,9 +279,6 @@
279 279 struct mem_dqblk dq_dqb; /* Diskquota usage */
280 280 };
281 281  
282   -#define QUOTA_OK 0
283   -#define NO_QUOTA 1
284   -
285 282 /* Operations which must be implemented by each quota format */
286 283 struct quota_format_ops {
287 284 int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */