Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3688388ybv; Mon, 10 Feb 2020 04:44:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzIXdN1QjSntGZtdaYvpUlJoTiv12BQESHHz3LOq3nkYj8wvLTPfFGafMzFCRmKbPq44EvG X-Received: by 2002:a05:6830:12d5:: with SMTP id a21mr943659otq.296.1581338668833; Mon, 10 Feb 2020 04:44:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581338668; cv=none; d=google.com; s=arc-20160816; b=kzGFfI7LX3RONzSDe1OIvR83H2ssJpqL0t6SuvsQ0MFtn7w0FahaRIw+SHig61Gnfj 3S82dcVITXV/PQwp4N95Ex6X9HUDbZj4qxTkGSI16SXmdGPXAR5ihZTqAQpfu2zfTAqv itVN2hv2rGDGaCyXFj4K5STOzZ9yfYEKDmAgLS8NvoGtmDoQPx1zJgCPrwtVswphS2rQ r5Vxkm+q24OZKojenhPeMQ556TV7OP79NvFgme0gbehgL6LA1SBc7B3t97BEEFvT00aU XvMbhaPvTk/NirTvyQqoPqIGJEpW/uK5Yyb3joUd2U9w8MJUKKBn3BlWIpdt+Kv53Ghm 7L9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JUROkU7RTlBRmJ1+eqObyTWhgpjIFysmEmwFJorI0F4=; b=l/AbAL/nxWJ43goPLTcRD6RZ7TQXVhqKbe7NxkqMoUOua0cxVbU7o9+FEAqRBh2gWu 0N2qO7xrII0goQwxK7WgqTcIuGvoM5cMggdNQ9AG8l8deHSiX3XULr1fSfv+B9EzhU3i XEda6zrAVpEqXCsLMuKv1Gq2I2+bXhH37fyqxrKkzDH67CB67y+ThzTiBJvzsiOzsRI0 azgcjvyT/tghbkAjT80qE++VMz8ikmRsz2PbqsQ4TUSTmNGpU3iuSwavJIV2rZG9JZai 27k5AuRVTMw7A5Un743tywjC+zy7mOZEoZGq9K5ekWYuGZ+iBWabjRaSQo8PBhIy2L5c W2Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=psiH1FDz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si133908otr.64.2020.02.10.04.44.17; Mon, 10 Feb 2020 04:44:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=psiH1FDz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730544AbgBJMoB (ORCPT + 99 others); Mon, 10 Feb 2020 07:44:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:39978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727880AbgBJMkS (ORCPT ); Mon, 10 Feb 2020 07:40:18 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 376782051A; Mon, 10 Feb 2020 12:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338417; bh=eNbSzKnGhFlJ968LROIwRDi3+9NQV0GsMHanD6wDiTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=psiH1FDzqZZ1V8IUtd11WvxpHkX03uFASNW2usPAZ/kWBOpamSOmq6tjm6ytm+wNS hsxvZhraT1+Le7SdFBI6L4jU4c/nP6dlOofH9Ij6GTmj5ku3nJUjld3yoPt6mMb56o R/qaDuHuTzbPwGGOxP2jHIm8g32osBx/yrp55jKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengguang Xu , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.5 133/367] f2fs: code cleanup for f2fs_statfs_project() Date: Mon, 10 Feb 2020 04:30:46 -0800 Message-Id: <20200210122437.144835011@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chengguang Xu commit bf2cbd3c57159c2b639ee8797b52ab5af180bf83 upstream. Calling min_not_zero() to simplify complicated prjquota limit comparison in f2fs_statfs_project(). Signed-off-by: Chengguang Xu Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/super.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1213,12 +1213,8 @@ static int f2fs_statfs_project(struct su return PTR_ERR(dquot); spin_lock(&dquot->dq_dqb_lock); - limit = 0; - if (dquot->dq_dqb.dqb_bsoftlimit) - 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); if (limit) limit >>= sb->s_blocksize_bits; @@ -1230,12 +1226,8 @@ static int f2fs_statfs_project(struct su (buf->f_blocks - curblock) : 0; } - limit = 0; - if (dquot->dq_dqb.dqb_isoftlimit) - 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;