Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2445932pxa; Mon, 24 Aug 2020 14:35:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHqzbQmJYg87N57FbcPifSkYNDtaPlHJASIJ+k79piVr5lkmXYZbxi8rTgzPO9+zNTfl68 X-Received: by 2002:a17:906:e59:: with SMTP id q25mr530989eji.143.1598304933890; Mon, 24 Aug 2020 14:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598304933; cv=none; d=google.com; s=arc-20160816; b=ErmKANcDRGvxp3e6CZrzqYs3xIE+08mSaz3WlgvXWY65oFr2ihgsAjgK7PRvnfP7ZS Q/CgH1q/Qrz7Kr8r3P6ro9i++YAwQb+JbRa9DOzgRm6c/6tiSwqGTEWouzsos/S0YSHX 3VooIs62RZ5ECgiUBGwQaJqEIYXTxnAV3QuSVP/k2Kn2d1FeT6oLVdyG3Bzpc/ytPXUY gdYoDL3JFgGTUDwc/E3SUGiDh3Vaf2DVCPkxrx6PbtQeSmKzJkSxDLQr7vKLHmYslTba 2TmR28q+lvE20jM5OROV5wy/2JVir0NtgoEtUPelpseorExfEjgEtm9TL1GMU6mlXLIG dBYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:to:cc:in-reply-to:date:subject :mime-version:message-id:from:dkim-signature; bh=ovAyn4Poe4VsI6v8u6x7bM5uzaIaijG/macBqt+tzP8=; b=Mo+TmQGoxY02EYcSyqGKdI5SvHUrt9ZNHUjcIhuab1b38Bn/0XdDISMqEL3YAnHsnd 5/BSYsfYRFq9r77UWdRHcKcxW3AMLu4DzQiAQoT2mQMbDP+Ez/RQYB5Vy/dGpzUAYM3B 2k0ideILp5MkmpXhC3hNQcoaPyOMlv3nqj4zCmGUi4TPi2fN1F1AvQS0RBJrRUgpxhmf vN/P/ybVf6Z77r89KQlLO8ok+wZ3Yfn38HH+QI5lVPyR/FXHuluMVetVtaWSB+mudhTf qEw47ixMdZSonXUx9uhDRlnEep766huTg6RKwK5B/roiaPeQms2eA7KtOAqM7R+L85s5 gNBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b=CYndytIs; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e13si3644440ejd.36.2020.08.24.14.35.04; Mon, 24 Aug 2020 14:35:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b=CYndytIs; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726365AbgHXVez (ORCPT + 99 others); Mon, 24 Aug 2020 17:34:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgHXVey (ORCPT ); Mon, 24 Aug 2020 17:34:54 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC816C061574 for ; Mon, 24 Aug 2020 14:34:53 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id g6so122054pjl.0 for ; Mon, 24 Aug 2020 14:34:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilger-ca.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=ovAyn4Poe4VsI6v8u6x7bM5uzaIaijG/macBqt+tzP8=; b=CYndytIs1bzqd+BqGkVWuiC7KVK29GFSZT9yB1e6uumqNWxvtsZuqBPD4jNseVFR96 ucrL5v5wJ2TzqwJYVhWDZcOC+RR3zqhwRiG76LMu/fPbiT6j83cr8J81nfnzwjuRLpGq FyAMYGSaH3vP5dxlN3p2Jl9BaZ4Jrm7hv0yKqYjzksAdQaPOG4idohrU3298gUuE/JN9 5cSxKFCVdS0BQtbyf0kaJz66h5kZjMct8rVvWk6dpeJvHG+NRTM4ZdUtVvTbicw6uOc1 vEEKsds+oBDNRRM3R52JB20EAIL2fz21VeuU6EvIpy5kOzClHC91vCT3zSdkbbVFAq93 dVZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=ovAyn4Poe4VsI6v8u6x7bM5uzaIaijG/macBqt+tzP8=; b=mrZEH6cvoKKocCNmYG9FjrzsND+XBit528FbfGM26uxfM2FE4FG/8wq7HFnvBtiYXc 7CO2q3oWKhXwL61MPukUNy++bnhvZGUU/hw/ysjpyxxhJ3iSwmowxEUT/yJx+LUAHvC3 +Oa401a+A2SxEuYwToNSIpJawBE3mxCMxKPXQIIB9zB5kRY21403Bx80oJUhGotAGfSi 0qhsgGF3Oi+Hm0CC4iLu3F3e2bV2Ww9bIdRzYEEzgzhddiZP3qzqTUs3p5zytsIe5515 9m1SLJZOj+fcMGa+SSuQDz2oyH9FM4Ehdng8kZx59wd917vVVJ1kEJHgSCo/hRzGqvkJ YERw== X-Gm-Message-State: AOAM5323hjKfBCW4nRmojIaEMGvHxtlQ/qar8uRgcXPpeQzVoAYIaZu/ KDoyNx1Q0uzh5XZUcug8EadcDQSE0TYjBWZN X-Received: by 2002:a17:90a:9503:: with SMTP id t3mr971422pjo.171.1598304893436; Mon, 24 Aug 2020 14:34:53 -0700 (PDT) Received: from [192.168.10.160] (S01061cabc081bf83.cg.shawcable.net. [70.77.221.9]) by smtp.gmail.com with ESMTPSA id na14sm417354pjb.6.2020.08.24.14.34.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Aug 2020 14:34:52 -0700 (PDT) From: Andreas Dilger Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_B4C19C5C-A0E1-4B4F-A1FC-6EB055F4EF04"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH v5 1/2] ext4: reorganize if statement of ext4_mb_release_context() Date: Mon, 24 Aug 2020 15:34:49 -0600 In-Reply-To: <5439ac6f-db79-ad68-76c1-a4dda9aa0cc3@gmail.com> Cc: "Theodore Y. Ts'o" , Ritesh Harjani , Jan Kara , Ext4 Developers List To: brookxu References: <530dadc7-7bee-6d90-38b8-3af56c428297@gmail.com> <20200815133212.8D164A4057@d06av23.portsmouth.uk.ibm.com> <5439ac6f-db79-ad68-76c1-a4dda9aa0cc3@gmail.com> X-Mailer: Apple Mail (2.3273) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org --Apple-Mail=_B4C19C5C-A0E1-4B4F-A1FC-6EB055F4EF04 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Aug 17, 2020, at 1:36 AM, brookxu wrote: >=20 > Reorganize the if statement of ext4_mb_release_context(), make it > easier to read. >=20 > Signed-off-by: Chunguang Xu Reviewed-by: Andreas Dilger > --- > fs/ext4/mballoc.c | 27 +++++++++++++-------------- > 1 file changed, 13 insertions(+), 14 deletions(-) >=20 > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index 70b110f..51f37f1 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -4567,20 +4567,19 @@ static int ext4_mb_release_context(struct = ext4_allocation_context *ac) > pa->pa_free -=3D ac->ac_b_ex.fe_len; > pa->pa_len -=3D ac->ac_b_ex.fe_len; > spin_unlock(&pa->pa_lock); > - } > - } > - if (pa) { > - /* > - * We want to add the pa to the right bucket. > - * Remove it from the list and while adding > - * make sure the list to which we are adding > - * doesn't grow big. > - */ > - if ((pa->pa_type =3D=3D MB_GROUP_PA) && = likely(pa->pa_free)) { > - spin_lock(pa->pa_obj_lock); > - list_del_rcu(&pa->pa_inode_list); > - spin_unlock(pa->pa_obj_lock); > - ext4_mb_add_n_trim(ac); > + > + /* > + * We want to add the pa to the right bucket. > + * Remove it from the list and while adding > + * make sure the list to which we are adding > + * doesn't grow big. > + */ > + if (likely(pa->pa_free)) { > + spin_lock(pa->pa_obj_lock); > + list_del_rcu(&pa->pa_inode_list); > + spin_unlock(pa->pa_obj_lock); > + ext4_mb_add_n_trim(ac); > + } > } > ext4_mb_put_pa(ac, ac->ac_sb, pa); > } > -- > 1.8.3.1 >=20 >=20 Cheers, Andreas --Apple-Mail=_B4C19C5C-A0E1-4B4F-A1FC-6EB055F4EF04 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAl9EMnkACgkQcqXauRfM H+DINhAApbmuErKVkyGroY7x2EZI5rxfhDQWmJv+2wZ36zz7zNJDzmRdn4sCdgX0 piDJGS2K57tk7rjT0LReiNpe/dMjfF0LOgm7lgj1Qr20HDXVoo6C/D0qUW6AAKTD NqiFNEAQxOeVEpw1+KjA2KNqpvQdeyF6cAAwxAZGqIqYF55LqnWhkRuTzLE86jKK Xal+KHd4VoflZP6J7L1m5k9QIUXJqSWb//OxdPsPTP5cWKoW7BCv+4AGbXWvfcBb KgFvTCLKgZGleo8qWW4mxzG1bduIQCT8yVEKaJx2RZgYZc1cGtRMTmyJH8J66ibY 4NMW83o5KPjhsOxB+mzujZb1sSrkLpgEtfH9MyzF0+81C5YdyBBJCEXrFoIjOQmn dNNJzKmswURVpHTeeZ44sSRAxq5PpuKpcHJb1msRLo8/tyTH2qJKKW2jPXf0eNli 4LBL1NLSq84bCR2YTgBWrXa6CUeQxLvwRcfZzOreeA0G6Jwvr6lZwTOXLXXDko6b 0fIG/y5BpU62+rHd51AHG0GzbesN2hSwf5sxJKon5p02E+JlkFadww4NBfK1dUe7 Dt3WBHl9w3FFF4iubQaySy94KEweoWIGJhboCdTa9LH1yXNlkeOz5dzp7JHchk+F xRVZbj/HpdI1txjxMfK5BzjkBzl1wB43cSoLzKeZhYkZ8Aa0aso= =o8kZ -----END PGP SIGNATURE----- --Apple-Mail=_B4C19C5C-A0E1-4B4F-A1FC-6EB055F4EF04--