Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186115
b: refs/heads/master
c: efd8f0e
h: refs/heads/master
i:
  186113: 260d171
  186111: d2f318f
v: v3
  • Loading branch information
Christoph Hellwig authored and Jan Kara committed Mar 4, 2010
1 parent a7ea3f9 commit 506295f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 871a293155a24554e153538d36e3a80fa169aefb
refs/heads/master: efd8f0e6f6c1faa041f228d7113bd3a9db802d49
48 changes: 24 additions & 24 deletions trunk/fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,13 +1181,13 @@ static int check_idq(struct dquot *dquot, qsize_t inodes, char *warntype)
*warntype = QUOTA_NL_NOWARN;
if (!sb_has_quota_limits_enabled(dquot->dq_sb, dquot->dq_type) ||
test_bit(DQ_FAKE_B, &dquot->dq_flags))
return QUOTA_OK;
return 0;

if (dquot->dq_dqb.dqb_ihardlimit &&
newinodes > dquot->dq_dqb.dqb_ihardlimit &&
!ignore_hardlimit(dquot)) {
*warntype = QUOTA_NL_IHARDWARN;
return NO_QUOTA;
return -EDQUOT;
}

if (dquot->dq_dqb.dqb_isoftlimit &&
Expand All @@ -1196,7 +1196,7 @@ static int check_idq(struct dquot *dquot, qsize_t inodes, char *warntype)
get_seconds() >= dquot->dq_dqb.dqb_itime &&
!ignore_hardlimit(dquot)) {
*warntype = QUOTA_NL_ISOFTLONGWARN;
return NO_QUOTA;
return -EDQUOT;
}

if (dquot->dq_dqb.dqb_isoftlimit &&
Expand All @@ -1207,7 +1207,7 @@ static int check_idq(struct dquot *dquot, qsize_t inodes, char *warntype)
sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace;
}

return QUOTA_OK;
return 0;
}

/* needs dq_data_lock */
Expand All @@ -1219,7 +1219,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
*warntype = QUOTA_NL_NOWARN;
if (!sb_has_quota_limits_enabled(sb, dquot->dq_type) ||
test_bit(DQ_FAKE_B, &dquot->dq_flags))
return QUOTA_OK;
return 0;

tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace
+ space;
Expand All @@ -1229,7 +1229,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
!ignore_hardlimit(dquot)) {
if (!prealloc)
*warntype = QUOTA_NL_BHARDWARN;
return NO_QUOTA;
return -EDQUOT;
}

if (dquot->dq_dqb.dqb_bsoftlimit &&
Expand All @@ -1239,7 +1239,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
!ignore_hardlimit(dquot)) {
if (!prealloc)
*warntype = QUOTA_NL_BSOFTLONGWARN;
return NO_QUOTA;
return -EDQUOT;
}

if (dquot->dq_dqb.dqb_bsoftlimit &&
Expand All @@ -1255,10 +1255,10 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
* We don't allow preallocation to exceed softlimit so exceeding will
* be always printed
*/
return NO_QUOTA;
return -EDQUOT;
}

return QUOTA_OK;
return 0;
}

static int info_idq_free(struct dquot *dquot, qsize_t inodes)
Expand Down Expand Up @@ -1507,9 +1507,9 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number,
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
if (!inode->i_dquot[cnt])
continue;
if (check_bdq(inode->i_dquot[cnt], number, !warn, warntype+cnt)
== NO_QUOTA) {
ret = -EDQUOT;
ret = check_bdq(inode->i_dquot[cnt], number, !warn,
warntype+cnt);
if (ret) {
spin_unlock(&dq_data_lock);
goto out_flush_warn;
}
Expand Down Expand Up @@ -1541,7 +1541,7 @@ EXPORT_SYMBOL(__dquot_alloc_space);
*/
int dquot_alloc_inode(const struct inode *inode)
{
int cnt, ret = -EDQUOT;
int cnt, ret = 0;
char warntype[MAXQUOTAS];

/* First test before acquiring mutex - solves deadlocks when we
Expand All @@ -1555,8 +1555,8 @@ int dquot_alloc_inode(const struct inode *inode)
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
if (!inode->i_dquot[cnt])
continue;
if (check_idq(inode->i_dquot[cnt], 1, warntype+cnt)
== NO_QUOTA)
ret = check_idq(inode->i_dquot[cnt], 1, warntype + cnt);
if (ret)
goto warn_put_all;
}

Expand All @@ -1565,7 +1565,7 @@ int dquot_alloc_inode(const struct inode *inode)
continue;
dquot_incr_inodes(inode->i_dquot[cnt], 1);
}
ret = 0;

warn_put_all:
spin_unlock(&dq_data_lock);
if (ret == 0)
Expand Down Expand Up @@ -1683,14 +1683,14 @@ static int __dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask
qsize_t rsv_space = 0;
struct dquot *transfer_from[MAXQUOTAS];
struct dquot *transfer_to[MAXQUOTAS];
int cnt, ret = QUOTA_OK;
int cnt, ret = 0;
char warntype_to[MAXQUOTAS];
char warntype_from_inodes[MAXQUOTAS], warntype_from_space[MAXQUOTAS];

/* First test before acquiring mutex - solves deadlocks when we
* re-enter the quota code and are already holding the mutex */
if (IS_NOQUOTA(inode))
return QUOTA_OK;
return 0;
/* Initialize the arrays */
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
transfer_from[cnt] = NULL;
Expand All @@ -1715,9 +1715,11 @@ static int __dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask
if (!transfer_to[cnt])
continue;
transfer_from[cnt] = inode->i_dquot[cnt];
if (check_idq(transfer_to[cnt], 1, warntype_to + cnt) ==
NO_QUOTA || check_bdq(transfer_to[cnt], space, 0,
warntype_to + cnt) == NO_QUOTA)
ret = check_idq(transfer_to[cnt], 1, warntype_to + cnt);
if (ret)
goto over_quota;
ret = check_bdq(transfer_to[cnt], space, 0, warntype_to + cnt);
if (ret)
goto over_quota;
}

Expand Down Expand Up @@ -1771,7 +1773,6 @@ static int __dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask
/* Clear dquot pointers we don't want to dqput() */
for (cnt = 0; cnt < MAXQUOTAS; cnt++)
transfer_from[cnt] = NULL;
ret = NO_QUOTA;
goto warn_put_all;
}

Expand All @@ -1793,8 +1794,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
}
if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) {
dquot_initialize(inode);
if (__dquot_transfer(inode, chid, mask) == NO_QUOTA)
return -EDQUOT;
return __dquot_transfer(inode, chid, mask);
}
return 0;
}
Expand Down
3 changes: 0 additions & 3 deletions trunk/include/linux/quota.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ struct dquot {
struct mem_dqblk dq_dqb; /* Diskquota usage */
};

#define QUOTA_OK 0
#define NO_QUOTA 1

/* Operations which must be implemented by each quota format */
struct quota_format_ops {
int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */
Expand Down

0 comments on commit 506295f

Please sign in to comment.