[06/10] ext4: replace the traditional ternary conditional operator with with max()/min()
Message ID | 20230721171007.2065423-7-shikemeng@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp78796vqg; Fri, 21 Jul 2023 02:27:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlFrpRtxUiytkW004ubHoTNjTL8WZ5gqRy7t1ynCh/St7UXDojTmygop6N8fTiSd/843xXVM X-Received: by 2002:a05:6a20:cb:b0:131:a3b1:5677 with SMTP id 11-20020a056a2000cb00b00131a3b15677mr1109589pzh.20.1689931653819; Fri, 21 Jul 2023 02:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689931653; cv=none; d=google.com; s=arc-20160816; b=eYBYIk6uBNZqRSq/N3kTfPIrmVYUZTzvq6eHopI3H4o0y+nh0Xtomnx5GqdLPnj5/g O3y3kT1sZpGKuuLegQL8g83eWtI34hn5GQP/7vKXngUZ/PZ0XLx6TZxfq+504LADCTMs Fte664bXvHrUfQWd5D2SJhPLllHpEq4skf9RlgVYMduA1BBcsl56BIeWwEjsLUTFcC/s cpgdT1PQ0sSLK/XPL6hhrDliSGohtZz/+gMWrtdCFt+qrpIfNr1RJvjlQleRQuHMI4RL bHSkndXMSix9AI9qilB/oWh06plVDmPy5/qHrpAZL7dmKVmo6/yxMPcB0l5oAq/iHzaS gLHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Z6KxAWVM1q+OTanohiuVuMarMnbUF16ttguRbBDzNfA=; fh=MlGqaUnvBjpXmiP990bdf+mzv9VjPrVaE5OVdv29XYE=; b=Zl/8a0pLxjEmaJ+X5aiYLJ9Ektw25bYW888h9V/iUdEZ3CROvOX1bcCx7tieyTX/71 HGVwvVUitEXdg0fo+Qr/9DIqh4jAzMwmDjxbZYUF8+e8ozC6W416rbg9ORd22vJSyXWt UM5tQKQNNZEHRypOkM879GQVvSCCN7TlTbH5OckuT8s8OW8KfHNXNo3habt+Wj5bGFPh 74X+1uyLP0G0UH1Z0xMObIkVDsdeDJpuLIi9pVC5VnxGmof8tNTLqKPg6fjTpq5FuhQN OsYrtSuPPEHuykKsTGVZyKV+HlT6+3bTO/VvI2UrkeAFm+YbKAX8QYHjPWvWB9Hn3QkY oXyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9-20020a170903120900b001b5589848absi2777423plh.234.2023.07.21.02.27.19; Fri, 21 Jul 2023 02:27:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231639AbjGUJKC (ORCPT <rfc822;assdfgzxcv4@gmail.com> + 99 others); Fri, 21 Jul 2023 05:10:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231379AbjGUJJm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 21 Jul 2023 05:09:42 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F33F730C7; Fri, 21 Jul 2023 02:09:41 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4R6kJx5yGSz4f3n6L; Fri, 21 Jul 2023 17:09:37 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAHvrFPS7pkqi7fOQ--.527S8; Fri, 21 Jul 2023 17:09:38 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: tytso@mit.edu, adilger.kernel@dilger.ca, ritesh.list@gmail.com, ojaswin@linux.ibm.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Cc: shikemeng@huaweicloud.com Subject: [PATCH 06/10] ext4: replace the traditional ternary conditional operator with with max()/min() Date: Sat, 22 Jul 2023 01:10:03 +0800 Message-Id: <20230721171007.2065423-7-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230721171007.2065423-1-shikemeng@huaweicloud.com> References: <20230721171007.2065423-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAHvrFPS7pkqi7fOQ--.527S8 X-Coremail-Antispam: 1UD129KBjvdXoW7GF45XryfGw1kWFy3KFyxuFg_yoWDXFX_Ga 47Ary8Gry3GrWFkFy0vrsYvr409an5try5XrW5tFW8AFyUJ3y0vwnrZr4fGF4xuFWYyrsF ywn3WF97GF1SgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbDkFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJ M28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2I x0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK 6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4 xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8 JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20V AGYxC7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAF wI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc4 0Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AK xVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr 1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7sRiVbyDUU UUU== X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, KHOP_HELO_FCRDNS,MAY_BE_FORGED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772021774073571516 X-GMAIL-MSGID: 1772021774073571516 |
Series |
A few fixes and cleanups to mballoc
|
|
Commit Message
Kemeng Shi
July 21, 2023, 5:10 p.m. UTC
Replace the traditional ternary conditional operator with with max()/min()
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
fs/ext4/mballoc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Comments
Kemeng Shi <shikemeng@huaweicloud.com> writes: > Replace the traditional ternary conditional operator with with max()/min() sure. > > Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> > --- > fs/ext4/mballoc.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) Looks good to me, feel free to add: Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> -ritesh > > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index 78160bf5b533..412d335583fe 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -6699,8 +6699,7 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) > void *bitmap; > > bitmap = e4b->bd_bitmap; > - start = (e4b->bd_info->bb_first_free > start) ? > - e4b->bd_info->bb_first_free : start; > + start = max(e4b->bd_info->bb_first_free, start); > count = 0; > free_count = 0; > > @@ -6917,8 +6916,7 @@ ext4_mballoc_query_range( > > ext4_lock_group(sb, group); > > - start = (e4b.bd_info->bb_first_free > start) ? > - e4b.bd_info->bb_first_free : start; > + start = max(e4b.bd_info->bb_first_free, start); > if (end >= EXT4_CLUSTERS_PER_GROUP(sb)) > end = EXT4_CLUSTERS_PER_GROUP(sb) - 1; > > -- > 2.30.0
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 78160bf5b533..412d335583fe 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -6699,8 +6699,7 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) void *bitmap; bitmap = e4b->bd_bitmap; - start = (e4b->bd_info->bb_first_free > start) ? - e4b->bd_info->bb_first_free : start; + start = max(e4b->bd_info->bb_first_free, start); count = 0; free_count = 0; @@ -6917,8 +6916,7 @@ ext4_mballoc_query_range( ext4_lock_group(sb, group); - start = (e4b.bd_info->bb_first_free > start) ? - e4b.bd_info->bb_first_free : start; + start = max(e4b.bd_info->bb_first_free, start); if (end >= EXT4_CLUSTERS_PER_GROUP(sb)) end = EXT4_CLUSTERS_PER_GROUP(sb) - 1;