Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp19661013ybl; Sat, 4 Jan 2020 06:22:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzEMv1JTpcxlJJVEeDpAQBOTDlSSOTnkf579IokTna04WiPfuqiFN3XeG+QhVZhMYKK2cZq X-Received: by 2002:a9d:24ea:: with SMTP id z97mr107346731ota.345.1578147728984; Sat, 04 Jan 2020 06:22:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1578147728; cv=pass; d=google.com; s=arc-20160816; b=NM2cyTYkZWljRj95mh/JVfA/j+InFKZ8ZeXjuAhgGvVcd1hDt6IhMi7XdnxswKPHFE ywKDnmy6CbX8PX3lMSbneQf74jNQYUnOA5bZ/znEeQIJwyMbz3rni1cq7qhadlVFi4n7 NN0WW6GpZfNGc5lggMc+icHOIOli8FSXjo347XyWiu/14VSencoXpbBCtvaB19WcZLow icqBhfiBnNiwL3BedwZChSIPcistHnvR13zhUyl3e046quz0dEL8i+L+RY9o1Fzy8Nqr LHhq8e+XIWbh+hTq40AtceqateJmy2nE363v68vHBiKNSR6NDKoPWcxJdyLxl6unRDX1 q33Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:subject:message-id:cc:to:from :dkim-signature; bh=7k8gaLXukPzjJGyY+xIC8DOJaUh+oLrwvPFiks3Knak=; b=XZkabe15It39lbIZ97iSMgLl9ooWFUbu/QfAwKMrXppD5LMecrF42/0Uxf+ndL9G3U 7Ts5KpRb7ymEfhQZNp+gDovjHRDZ/5UupMLv9xNQQNKO2WFIfBkdABsRK6G2oG2IU3N7 +bDEm0HGSwTarPi0xBN53s1EBw7PBRJk/ap2gASxMufDfZvq/SmgCY5DrFbFNcdlZItD 77EZFlTLthjpD5iVIzjDvXaAPypPgcY4Db1ibVftm0FmF7uN8xWn8K78+HV/gGHj38z/ rpKhm6Vw/ND1iV/uZlLslINEY4i0CN6cqFI7Vj26qIaa9L6glWhBuxHGCIfEVgJEeSrg 0YWw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=cng1tKuB; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); 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 h128si31150648oif.258.2020.01.04.06.21.56; Sat, 04 Jan 2020 06:22:08 -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=@mykernel.net header.s=zohomail header.b=cng1tKuB; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); 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 S1726260AbgADOVS (ORCPT + 99 others); Sat, 4 Jan 2020 09:21:18 -0500 Received: from sender2-of-o52.zoho.com.cn ([163.53.93.247]:21134 "EHLO sender2-of-o52.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbgADOVR (ORCPT ); Sat, 4 Jan 2020 09:21:17 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578147631; cv=none; d=zoho.com.cn; s=zohoarc; b=Wm1LmxEiRdnPxgUwAF6QFOvou39oZfviXf6u9vBIe+s4Wp24uY8rW49btrDPv9isBkv4WKchZ9HgTPykYIZYlv383SWfGnsJuhY7fQAhR2Fyp9kER6BjGvkqh8S9kXxOTn03xPJABz/DQKZNNUnobxZE0uPuw6GceLkABB4hoiw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1578147631; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=7k8gaLXukPzjJGyY+xIC8DOJaUh+oLrwvPFiks3Knak=; b=fZJBaexuGyqp/gqCJVR0N/D7EWMuF9C8MMisxzgrbDxZ8XIW+hjdXF+uBCK/GoiQTc8zGXJlV8Yr4I/RlulMlp+OGQVzVQPBWIxcLi9Y8IjzvQ5IDA+CSaWlEwQ1JlO2DYxgxqC4rRXlIDdiUa3z2Z3AtGKuk9Ezlc5gkOU/45Y= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=mykernel.net; spf=pass smtp.mailfrom=cgxu519@mykernel.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578147631; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=7k8gaLXukPzjJGyY+xIC8DOJaUh+oLrwvPFiks3Knak=; b=cng1tKuBAc7ah7mdBkmJMkb1ivGDCz7jaUqTUyBO/pfGl6X47GgFlfPQzTB0R8dF mpQSMQnATVk2uNkaUraso0szktsumaHmGPg5zINaL4UFB9+wZguvZtGIiYZiG/jyoCZ nE/r+3MgyPNA1dCdAgiFTowqWQKHmYrcPzLzBeXI= Received: from localhost.localdomain.localdomain (113.116.49.111 [113.116.49.111]) by mx.zoho.com.cn with SMTPS id 1578147629444192.7016564807659; Sat, 4 Jan 2020 22:20:29 +0800 (CST) From: Chengguang Xu To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chengguang Xu Message-ID: <20200104142004.12883-2-cgxu519@mykernel.net> Subject: [f2fs-dev][PATCH 2/2] f2fs: code cleanup for f2fs_statfs_project() Date: Sat, 4 Jan 2020 22:20:04 +0800 X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200104142004.12883-1-cgxu519@mykernel.net> References: <20200104142004.12883-1-cgxu519@mykernel.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Content-Type: text/plain; charset=utf8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Calling min_not_zero() to simplify complicated prjquota limit comparison in f2fs_statfs_project(). Signed-off-by: Chengguang Xu --- fs/f2fs/super.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 78efd0e76174..ac01c3f8863d 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1213,12 +1213,8 @@ static int f2fs_statfs_project(struct super_block *s= b, =09=09return PTR_ERR(dquot); =09spin_lock(&dquot->dq_dqb_lock); =20 -=09limit =3D 0; -=09if (dquot->dq_dqb.dqb_bsoftlimit) -=09=09limit =3D dquot->dq_dqb.dqb_bsoftlimit; -=09if (dquot->dq_dqb.dqb_bhardlimit && -=09=09=09(!limit || dquot->dq_dqb.dqb_bhardlimit < limit)) -=09=09limit =3D dquot->dq_dqb.dqb_bhardlimit; +=09limit =3D min_not_zero(dquot->dq_dqb.dqb_bsoftlimit, +=09=09=09=09=09dquot->dq_dqb.dqb_bhardlimit); =09if (limit) =09=09limit >>=3D sb->s_blocksize_bits; =20 @@ -1230,12 +1226,8 @@ static int f2fs_statfs_project(struct super_block *s= b, =09=09=09 (buf->f_blocks - curblock) : 0; =09} =20 -=09limit =3D 0; -=09if (dquot->dq_dqb.dqb_isoftlimit) -=09=09limit =3D dquot->dq_dqb.dqb_isoftlimit; -=09if (dquot->dq_dqb.dqb_ihardlimit && -=09=09=09(!limit || dquot->dq_dqb.dqb_ihardlimit < limit)) -=09=09limit =3D dquot->dq_dqb.dqb_ihardlimit; +=09limit =3D min_not_zero(dquot->dq_dqb.dqb_isoftlimit, +=09=09=09=09=09dquot->dq_dqb.dqb_ihardlimit); =20 =09if (limit && buf->f_files > limit) { =09=09buf->f_files =3D limit; --=20 2.21.1