summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-01-13 22:05:49 +0000
committerAlex Elder <aelder@sgi.com>2010-01-21 13:44:22 -0600
commit4d1f88d75b00c4d23f4c51305ab5b779a86ef74e (patch)
tree9a0aa476c2c285a1557218a14f32f41cd1013f85 /fs
parent512dd1abd9539a474f2792eeaf6783c59ad7778a (diff)
downloadop-kernel-dev-4d1f88d75b00c4d23f4c51305ab5b779a86ef74e.zip
op-kernel-dev-4d1f88d75b00c4d23f4c51305ab5b779a86ef74e.tar.gz
xfs: clean up error handling in xfs_trans_dqresv
Move the error code selection after the goto label and fold the xfs_quota_error helper into it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/quota/xfs_trans_dquot.c48
1 files changed, 17 insertions, 31 deletions
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c
index 97ac964..b9db6f7 100644
--- a/fs/xfs/quota/xfs_trans_dquot.c
+++ b/fs/xfs/quota/xfs_trans_dquot.c
@@ -589,14 +589,6 @@ xfs_trans_unreserve_and_mod_dquots(
}
}
-STATIC int
-xfs_quota_error(uint flags)
-{
- if (flags & XFS_QMOPT_ENOSPC)
- return ENOSPC;
- return EDQUOT;
-}
-
/*
* This reserves disk blocks and inodes against a dquot.
* Flags indicate if the dquot is to be locked here and also
@@ -612,7 +604,6 @@ xfs_trans_dqresv(
long ninos,
uint flags)
{
- int error;
xfs_qcnt_t hardlimit;
xfs_qcnt_t softlimit;
time_t timer;
@@ -649,7 +640,6 @@ xfs_trans_dqresv(
warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount);
resbcountp = &dqp->q_res_rtbcount;
}
- error = 0;
if ((flags & XFS_QMOPT_FORCE_RES) == 0 &&
dqp->q_core.d_id &&
@@ -667,19 +657,13 @@ xfs_trans_dqresv(
* nblks.
*/
if (hardlimit > 0ULL &&
- (hardlimit <= nblks + *resbcountp)) {
- error = xfs_quota_error(flags);
+ hardlimit <= nblks + *resbcountp)
goto error_return;
- }
-
if (softlimit > 0ULL &&
- (softlimit <= nblks + *resbcountp)) {
- if ((timer != 0 && get_seconds() > timer) ||
- (warns != 0 && warns >= warnlimit)) {
- error = xfs_quota_error(flags);
- goto error_return;
- }
- }
+ softlimit <= nblks + *resbcountp &&
+ ((timer != 0 && get_seconds() > timer) ||
+ (warns != 0 && warns >= warnlimit)))
+ goto error_return;
}
if (ninos > 0) {
count = be64_to_cpu(dqp->q_core.d_icount);
@@ -692,16 +676,13 @@ xfs_trans_dqresv(
softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
if (!softlimit)
softlimit = q->qi_isoftlimit;
- if (hardlimit > 0ULL && count >= hardlimit) {
- error = xfs_quota_error(flags);
+
+ if (hardlimit > 0ULL && count >= hardlimit)
+ goto error_return;
+ if (softlimit > 0ULL && count >= softlimit &&
+ ((timer != 0 && get_seconds() > timer) ||
+ (warns != 0 && warns >= warnlimit)))
goto error_return;
- } else if (softlimit > 0ULL && count >= softlimit) {
- if ((timer != 0 && get_seconds() > timer) ||
- (warns != 0 && warns >= warnlimit)) {
- error = xfs_quota_error(flags);
- goto error_return;
- }
- }
}
}
@@ -736,9 +717,14 @@ xfs_trans_dqresv(
ASSERT(dqp->q_res_rtbcount >= be64_to_cpu(dqp->q_core.d_rtbcount));
ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount));
+ xfs_dqunlock(dqp);
+ return 0;
+
error_return:
xfs_dqunlock(dqp);
- return error;
+ if (flags & XFS_QMOPT_ENOSPC)
+ return ENOSPC;
+ return EDQUOT;
}
OpenPOWER on IntegriCloud