diff options
author | Bob Peterson <rpeterso@redhat.com> | 2023-05-31 20:31:52 +0300 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2023-09-05 16:58:18 +0300 |
commit | 2a4f651167560adae05e644e41d2666d727c549b (patch) | |
tree | 3d41b70e9550931a9945c69eb1c43c76abd68fed /fs/gfs2/quota.c | |
parent | e34c16c9c699461e7d3f9eed28069e3b8466d871 (diff) | |
download | linux-2a4f651167560adae05e644e41d2666d727c549b.tar.xz |
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 <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/quota.c')
-rw-r--r-- | fs/gfs2/quota.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 678b21cad303..fa1d48d5c112 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -1107,16 +1107,15 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid) return error; } -static int need_sync(struct gfs2_quota_data *qd) +static bool need_sync(struct gfs2_quota_data *qd) { struct gfs2_sbd *sdp = qd->qd_sbd; struct gfs2_tune *gt = &sdp->sd_tune; s64 value; unsigned int num, den; - int do_sync = 1; if (!qd->qd_qb.qb_limit) - return 0; + return false; spin_lock(&qd_lock); value = qd->qd_change; @@ -1128,19 +1127,19 @@ static int need_sync(struct gfs2_quota_data *qd) spin_unlock(>->gt_spin); if (value < 0) - do_sync = 0; + return false; else if ((s64)be64_to_cpu(qd->qd_qb.qb_value) >= (s64)be64_to_cpu(qd->qd_qb.qb_limit)) - do_sync = 0; + return false; else { value *= gfs2_jindex_size(sdp) * num; value = div_s64(value, den); value += (s64)be64_to_cpu(qd->qd_qb.qb_value); if (value < (s64)be64_to_cpu(qd->qd_qb.qb_limit)) - do_sync = 0; + return false; } - return do_sync; + return true; } void gfs2_quota_unlock(struct gfs2_inode *ip) @@ -1156,7 +1155,7 @@ void gfs2_quota_unlock(struct gfs2_inode *ip) for (x = 0; x < ip->i_qadata->qa_qd_num; x++) { struct gfs2_quota_data *qd; - int sync; + bool sync; qd = ip->i_qadata->qa_qd[x]; sync = need_sync(qd); |