From patchwork Mon Feb 10 12:31:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 231730 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B609AC352A3 for ; Mon, 10 Feb 2020 13:21:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 851AD20656 for ; Mon, 10 Feb 2020 13:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581340874; bh=eNbSzKnGhFlJ968LROIwRDi3+9NQV0GsMHanD6wDiTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qXAbKCfkMXzby3mOBmM5y2D4K9phPwrn3WVZIZtaH5wQU3+FA01YMvokF3tf6uDBO /b2Ziz9Ff3ykH5D9jRYtL8z2F4GsouK2UlmD/n1ZirwGpp2TFpuQziWDL9TebzXZZv KYEPW7Xbz79stQtN7GOjp/U9rGFLJXh7wh/gHAtc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728820AbgBJNVA (ORCPT ); Mon, 10 Feb 2020 08:21:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:59566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728248AbgBJMhe (ORCPT ); Mon, 10 Feb 2020 07:37:34 -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 8615E208C4; Mon, 10 Feb 2020 12:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338254; bh=eNbSzKnGhFlJ968LROIwRDi3+9NQV0GsMHanD6wDiTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXnifRD257a0s9m7BIHRLyzjOi61vVv+hUIzyAsx+puM+V6ELUETg2vaIImG5Cao8 I/wCrtE6QAkuySw5CSRa2I4AHvA2htorG9hj2SseiTh5lJE6eZfPUTUh9gNavV8iT3 vd/Yv3T8WIVq0hpuTECoP99hBsx5W3OSHLfhXfGk= 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.4 120/309] f2fs: code cleanup for f2fs_statfs_project() Date: Mon, 10 Feb 2020 04:31:16 -0800 Message-Id: <20200210122418.024104188@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122406.106356946@linuxfoundation.org> References: <20200210122406.106356946@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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;