linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: code cleanup for ext4_statfs_project()
@ 2020-02-10  8:24 Chengguang Xu
  2020-03-05 20:49 ` Theodore Y. Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Chengguang Xu @ 2020-02-10  8:24 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, Chengguang Xu

Calling min_not_zero() to simplify complicated prjquota
limit comparison in ext4_statfs_project().

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 fs/ext4/super.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 8434217549b3..5fc1f47f4c6f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5585,13 +5585,8 @@ static int ext4_statfs_project(struct super_block *sb,
 		return PTR_ERR(dquot);
 	spin_lock(&dquot->dq_dqb_lock);
 
-	limit = 0;
-	if (dquot->dq_dqb.dqb_bsoftlimit &&
-	    (!limit || dquot->dq_dqb.dqb_bsoftlimit < limit))
-		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) {
@@ -5603,14 +5598,8 @@ static int ext4_statfs_project(struct super_block *sb,
 			 (buf->f_blocks - curblock) : 0;
 	}
 
-	limit = 0;
-	if (dquot->dq_dqb.dqb_isoftlimit &&
-	    (!limit || dquot->dq_dqb.dqb_isoftlimit < limit))
-		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 =
-- 
2.21.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: code cleanup for ext4_statfs_project()
  2020-02-10  8:24 [PATCH] ext4: code cleanup for ext4_statfs_project() Chengguang Xu
@ 2020-03-05 20:49 ` Theodore Y. Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Y. Ts'o @ 2020-03-05 20:49 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: adilger.kernel, linux-ext4

On Mon, Feb 10, 2020 at 04:24:45PM +0800, Chengguang Xu wrote:
> Calling min_not_zero() to simplify complicated prjquota
> limit comparison in ext4_statfs_project().
> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-05 20:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10  8:24 [PATCH] ext4: code cleanup for ext4_statfs_project() Chengguang Xu
2020-03-05 20:49 ` Theodore Y. Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).