Skip to content

Commit 2a4f651

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: Simplify function need_sync
This patch simplifies function need_sync by eliminating a variable in favor of just returning the appropriate value as soon as we know it. Signed-off-by: Bob Peterson <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent e34c16c commit 2a4f651

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

fs/gfs2/quota.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,16 +1107,15 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid)
11071107
return error;
11081108
}
11091109

1110-
static int need_sync(struct gfs2_quota_data *qd)
1110+
static bool need_sync(struct gfs2_quota_data *qd)
11111111
{
11121112
struct gfs2_sbd *sdp = qd->qd_sbd;
11131113
struct gfs2_tune *gt = &sdp->sd_tune;
11141114
s64 value;
11151115
unsigned int num, den;
1116-
int do_sync = 1;
11171116

11181117
if (!qd->qd_qb.qb_limit)
1119-
return 0;
1118+
return false;
11201119

11211120
spin_lock(&qd_lock);
11221121
value = qd->qd_change;
@@ -1128,19 +1127,19 @@ static int need_sync(struct gfs2_quota_data *qd)
11281127
spin_unlock(&gt->gt_spin);
11291128

11301129
if (value < 0)
1131-
do_sync = 0;
1130+
return false;
11321131
else if ((s64)be64_to_cpu(qd->qd_qb.qb_value) >=
11331132
(s64)be64_to_cpu(qd->qd_qb.qb_limit))
1134-
do_sync = 0;
1133+
return false;
11351134
else {
11361135
value *= gfs2_jindex_size(sdp) * num;
11371136
value = div_s64(value, den);
11381137
value += (s64)be64_to_cpu(qd->qd_qb.qb_value);
11391138
if (value < (s64)be64_to_cpu(qd->qd_qb.qb_limit))
1140-
do_sync = 0;
1139+
return false;
11411140
}
11421141

1143-
return do_sync;
1142+
return true;
11441143
}
11451144

11461145
void gfs2_quota_unlock(struct gfs2_inode *ip)
@@ -1156,7 +1155,7 @@ void gfs2_quota_unlock(struct gfs2_inode *ip)
11561155

11571156
for (x = 0; x < ip->i_qadata->qa_qd_num; x++) {
11581157
struct gfs2_quota_data *qd;
1159-
int sync;
1158+
bool sync;
11601159

11611160
qd = ip->i_qadata->qa_qd[x];
11621161
sync = need_sync(qd);

0 commit comments

Comments
 (0)