Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5564528rwb; Mon, 8 Aug 2022 23:21:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR4suqEdiXRKB960HeOP7vmhlRl/2iTw+DfACkNbc1vv8j9rKmAINEfR6TW/LHmYhzJNZoLf X-Received: by 2002:a05:6402:40c2:b0:440:4ecd:f75f with SMTP id z2-20020a05640240c200b004404ecdf75fmr13062075edb.405.1660026095455; Mon, 08 Aug 2022 23:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660026095; cv=none; d=google.com; s=arc-20160816; b=RZd1e5+O/QOM3J3ghELJKgB90d1BZXC9+VUcwymKqabkcddaklUPlOkV3lswcdjoiL iCSwweFCOayI6jJqqZJ85p2ycdgh5uiDOpQb6YZO3ZzCXhLUoEgXcujQWPGRT6n7oLlQ iK4xjmDBP8Mr2ny91PMBh37XY65Imt+hS2n6HQv+3jqTKagdNpB1v78jnfJdyo03uILl lA7/1PObQ8/yC7FOwZvXUdB52ujCgFymHaf1HH5L+IbKvzDwU+lUmvWAIJDDaCx+ZiXu +FicRnf1aJXyOT4QLlOH1TMEpHcWq1nXwUWAdBe7euys7rZ625Lo5n2VslOnRKgDw+Fd GoJQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=nWSujNVLYOAC0UgNZNXBkAlGiv7EwMjesbiSHjhxGjU=; b=eXZO833KFlnDYLarCE6Dyu8FrfIIRyoL3wBmU+BMjCDvMJZeFWAERLBcKMseE9d6kR jJ43XcVus6FDDMV+ITP+GFMEr1rJUsgzghi+oM8doH2Kb9yXEG5BvPnHgXWZsM38QQBq dBwsJKJxRUKYfUnZjirMyzgkLrxI4asyRDlMEBBIgHllljoyKkYxmDgx+xOOkRfARO60 vJfgccRu7qe3mneOjAImHVfph0DLbtDQS8W3qdYeFcP4JwUaQ6wpUaJ5LJdSq0MtgrDV 1PmAzOhyb4/nlEOinpkK9gjufTFLt3cHMW8QbeIqDAQXw8uy1EVabJeGXl5qVNalPNzR ZTJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=RnibnApb; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i20-20020a170906699400b007308bfb02bdsi1242990ejr.433.2022.08.08.23.21.05; Mon, 08 Aug 2022 23:21:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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; dkim=pass header.i=@163.com header.s=s110527 header.b=RnibnApb; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231147AbiHIGLa (ORCPT + 99 others); Tue, 9 Aug 2022 02:11:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230456AbiHIGLa (ORCPT ); Tue, 9 Aug 2022 02:11:30 -0400 Received: from mail-m972.mail.163.com (mail-m972.mail.163.com [123.126.97.2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7B1E4CE0D; Mon, 8 Aug 2022 23:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=nWSuj NVLYOAC0UgNZNXBkAlGiv7EwMjesbiSHjhxGjU=; b=RnibnApbZmHe2hSWulUSG s90MoYTBVL2RhD51lAg2sy6jWA4oRcCn5tW+NGJwYlkSh159rqv9zfNuvQYclEQ3 J7pDRBcDSSr38mm9VyinIXisk7j1bNhD/unHTsWTZDhUwrUMdTndRNcg0YWAzGi5 LrIjIeMgyKasnbPUQ8j6Ds= Received: from localhost.localdomain (unknown [116.128.244.169]) by smtp2 (Coremail) with SMTP id GtxpCgCXNQhq+vFifQtOUg--.45249S2; Tue, 09 Aug 2022 14:10:51 +0800 (CST) From: Jiangshan Yi <13667453960@163.com> To: tytso@mit.edu, adilger.kernel@dilger.ca Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Jiangshan Yi Subject: [PATCH] fs/ext4: replace ternary operator with min() and max() Date: Tue, 9 Aug 2022 14:10:31 +0800 Message-Id: <20220809061031.3646725-1-13667453960@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GtxpCgCXNQhq+vFifQtOUg--.45249S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrZFyDtFWftF4UuF18XFW3GFg_yoWkXrcEka y7Aws2grWftr1S9F1Fkw42yFyI9w40kF13Xr98JFn5Ww45ZrWUJayvvr13ArZ8CrWYvr9x Xr1vkr1Utasa9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU1eyI5UUUUU== X-Originating-IP: [116.128.244.169] X-CM-SenderInfo: bprtllyxuvjmiwq6il2tof0z/1tbiVwtY+1etn6VJuwAAsN X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FROM_LOCAL_DIGITS,FROM_LOCAL_HEX,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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: X-Mailing-List: linux-ext4@vger.kernel.org From: Jiangshan Yi Fix the following coccicheck warning: fs/ext4/extents.c:2631: WARNING opportunity for max(). fs/ext4/extents.c:2632: WARNING opportunity for min(). min() and max() macro is defined in include/linux/minmax.h. It avoids multiple evaluations of the arguments when non-constant and performs strict type-checking. Signed-off-by: Jiangshan Yi --- fs/ext4/extents.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index c148bb97b527..3a74d0961024 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -2628,9 +2628,8 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, unwritten, ex_ee_len); path[depth].p_ext = ex; - a = ex_ee_block > start ? ex_ee_block : start; - b = ex_ee_block+ex_ee_len - 1 < end ? - ex_ee_block+ex_ee_len - 1 : end; + a = max(ex_ee_block, start); + b = min(ex_ee_block+ex_ee_len - 1, end); ext_debug(inode, " border %u:%u\n", a, b); -- 2.25.1 No virus found Checked by Hillstone Network AntiVirus