[v3,06/10] ext4: replace the traditional ternary conditional operator with with max()/min()
Message ID | 20230801143204.2284343-7-shikemeng@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2481263vqg; Mon, 31 Jul 2023 23:40:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlH5MUvVG49nA1QBCwGMLNR+OVq2Ixll4JsaNeAuxNmd01q8TY1XNcLEahuD6xFQ03n6L/qI X-Received: by 2002:a17:902:d503:b0:1bb:83ec:832 with SMTP id b3-20020a170902d50300b001bb83ec0832mr11127023plg.2.1690872027510; Mon, 31 Jul 2023 23:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690872027; cv=none; d=google.com; s=arc-20160816; b=fg6FPBl8UNdETa29tfwq0RyqyLdtC2+sAQVDgei4GaI0CP4rfBkVitZKO7nhlchyEX E8EcNCaS1VsRcdD33Pk/wZzjjk06DeIeA0jEdS8EwbsnPW21T/BqX48YTGn7UqVIbvAl 9q/6BNdt6eQAdZkXuptX7bPp95KDG/pHr5EIgeP+obK6NE8j8GaYXbS+z+UR4GSNWwOx zD/eITannQtbYuK8Zuypm0h1Bz5g29R4orjbcz3iqrg9ecyOtHHHf11+xlPYkAv4oFoi ImvclI6BcSvfxJXgHcXZdKZy4c9+nUQ1CPdpIukeXGk2az305J8QK+BpMP0G8Ax0fpJ0 ZQFQ== 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=ZWoZWujJTwLKo+SYHkrR2lJ7nxZpWsMw4EmpsACBO8I=; fh=MlGqaUnvBjpXmiP990bdf+mzv9VjPrVaE5OVdv29XYE=; b=vaqjAvrYa4NP9MZBWNiAiDiBmCZ6CExvvv2KXKvAzS/uhr20RbjhmBSIUkh4z/Hy9u H/ko9/bAvIc//t3TChnhTWtvFrBZUV2GhjP/wM1VWj1xJJr2E6MhqUGOnR1CtraLnbpQ +9HAOmDZqDWIHhlquLQGTOJKje09REiajV4gnJVBci1dLA/yL6dX6RoAY1ndI5gm53IL QJU1Fy/byAKP+3ANMCzNpWLtN/FT9zNedm8N5xKHVDN12bvg6BmtU+T4hyGAaVktq9pI HhTFAhKWR1LrPIKLehz2bY6xsepyRNU7k4YuaSexuU2fhDXH2zvA8/6TM8uXxTcULF8I PvEQ== 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 le15-20020a170902fb0f00b001bbc63065dfsi8403815plb.568.2023.07.31.23.40.14; Mon, 31 Jul 2023 23:40:27 -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 S230362AbjHAGcV (ORCPT <rfc822;cambridge8321@gmail.com> + 99 others); Tue, 1 Aug 2023 02:32:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230040AbjHAGbx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 1 Aug 2023 02:31:53 -0400 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92A99E48; Mon, 31 Jul 2023 23:31:52 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4RFQHk6zKpz4f3lY5; Tue, 1 Aug 2023 14:31:46 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgDnjOrQpshkMcvqPA--.21719S8; Tue, 01 Aug 2023 14:31:49 +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 v3 06/10] ext4: replace the traditional ternary conditional operator with with max()/min() Date: Tue, 1 Aug 2023 22:32:00 +0800 Message-Id: <20230801143204.2284343-7-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230801143204.2284343-1-shikemeng@huaweicloud.com> References: <20230801143204.2284343-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgDnjOrQpshkMcvqPA--.21719S8 X-Coremail-Antispam: 1UD129KBjvdXoW7GF45XryxZrW8uFW8JF4kXrb_yoWDtrb_Ga 4UAr18Gry3GrWFkry0qrsYvr48uan5try5WrWUtFW8XFyjq3yFvw1DZr43CF4xuFWjyrsF ywn3uFn7GF1IgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbDxFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJ M28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2I x0cI8IcVCY1x0267AKxVWxJr0_GcWl84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vE x4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I64 8v4I1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AK xVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrx kI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v2 6r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJw CI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjTRKfOwUUUU U X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, MAY_BE_FORGED,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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: 1773007827001929463 X-GMAIL-MSGID: 1773007827001929463 |
Series |
A few fixes and cleanups to mballoc
|
|
Commit Message
Kemeng Shi
Aug. 1, 2023, 2:32 p.m. UTC
Replace the traditional ternary conditional operator with with max()/min() Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> --- fs/ext4/mballoc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 2f26a91595ca..35b7a0ba25a3 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -6820,8 +6820,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; @@ -7038,8 +7037,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;