summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@mykernel.net>2020-02-10 16:24:45 +0800
committerTheodore Ts'o <tytso@mit.edu>2020-03-05 15:49:00 -0500
commita08fe66e4a0e12a3df982b28059f3a90e0f1b31e (patch)
tree905a5dd22ddf9f19c3d35c4e9df9bf7a2a7ad4a6 /fs
parent72f9da1d5c8d03d6fb242d01aae66928b2b2e7a8 (diff)
ext4: code cleanup for ext4_statfs_project()
Calling min_not_zero() to simplify complicated prjquota limit comparison in ext4_statfs_project(). Signed-off-by: Chengguang Xu <cgxu519@mykernel.net> Link: https://lore.kernel.org/r/20200210082445.2379-1-cgxu519@mykernel.net Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/super.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0c7c4adb664e..de5398c07161 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5622,10 +5622,8 @@ static int ext4_statfs_project(struct super_block *sb,
return PTR_ERR(dquot);
spin_lock(&dquot->dq_dqb_lock);
- limit = dquot->dq_dqb.dqb_bsoftlimit;
- if (dquot->dq_dqb.dqb_bhardlimit &&
- (!limit || dquot->dq_dqb.dqb_bhardlimit < limit))
- limit = dquot->dq_dqb.dqb_bhardlimit;
+ limit = min_not_zero(dquot->dq_dqb.dqb_bsoftlimit,
+ dquot->dq_dqb.dqb_bhardlimit);
limit >>= sb->s_blocksize_bits;
if (limit && buf->f_blocks > limit) {
@@ -5637,11 +5635,8 @@ static int ext4_statfs_project(struct super_block *sb,
(buf->f_blocks - curblock) : 0;
}
- limit = dquot->dq_dqb.dqb_isoftlimit;
- if (dquot->dq_dqb.dqb_ihardlimit &&
- (!limit || dquot->dq_dqb.dqb_ihardlimit < limit))
- limit = dquot->dq_dqb.dqb_ihardlimit;
-
+ limit = min_not_zero(dquot->dq_dqb.dqb_isoftlimit,
+ dquot->dq_dqb.dqb_ihardlimit);
if (limit && buf->f_files > limit) {
buf->f_files = limit;
buf->f_ffree =