Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6903714rwb; Tue, 22 Nov 2022 22:14:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf4fJwQ98xt4we6HjYFiglgk+lCpvZ0VnZxC47w69dd2Wk3EWiAwOLwzWzHQHTUp7KqG6H2i X-Received: by 2002:a17:90a:71c5:b0:213:b0e:ede8 with SMTP id m5-20020a17090a71c500b002130b0eede8mr18734962pjs.89.1669184062860; Tue, 22 Nov 2022 22:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669184062; cv=none; d=google.com; s=arc-20160816; b=NvZ5SKtncyOLUdXlXCwao5CvzsMzkuflEDmrFJViH+MM8ZPFIvEmlvdbmGeWnd903u qQmStzmNP+JylDBo1mLq+o2ZxifuY17aJizGZOlcAysNovwDlA+ln3duDw0r5aMz7rim pFdTSvQiEoRtJfbG7qHtuRpe8v2bBDNpLN8+MNCrNv6AB35c5gL/i8wstKbuqmZgyUgU JaiaQXavSbRPLZsH3z+bqwbk+5KtPVe8zq+kAma56WF7wpxwoe4fqysNSyrtEPUpseKm Clu2xH5Wz7jsjiT3EtlMQbhMofln/VYuJbXzk/gyFVrzRn++fe5bgTmKlojSJTl7n1+9 f+DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=3a2RkVfiDxYzQmdktFA6615MgVSMHHm+hBhNcYIQhx0=; b=O/ZcTJ0NqwJ163cO9EE/gQ1Ma02u2dlTu7N+azHlGzf4Fn5yjNJx20HkZL10yHVtkF /JPIFiRJhTPw5hNM/knhw5QM0qFfhRlZuVRKx9F9p86y8Uhro7JF0TyHTmBB/V4X5VsO YFZKnhCdXJx/owcoybzi/O1OK+mhkaaxL0JRV1Z18HpTOqknx3XlCjPrHlzNpcK+a9gr bk67EzM1hNXHukgfe1SwfW1E52A5/SA11bb4QPhUKF0OrETbond8VmpNr2cAjuItY2ec gizOxp7G1WuQJ5C9gIM61ifCuLm5bLbM8t6fbEYPyZVe1iE+/bbxre2k7LY984IRIjNC FQmQ== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a170903234d00b0016da027a727si17553789plh.116.2022.11.22.22.14.10; Tue, 22 Nov 2022 22:14:22 -0800 (PST) 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235941AbiKWGEy (ORCPT + 89 others); Wed, 23 Nov 2022 01:04:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235777AbiKWGEN (ORCPT ); Wed, 23 Nov 2022 01:04:13 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AE56F2C0A; Tue, 22 Nov 2022 22:04:12 -0800 (PST) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NH9Y73f6LzmW7J; Wed, 23 Nov 2022 14:03:39 +0800 (CST) Received: from huawei.com (10.174.178.129) by kwepemi500016.china.huawei.com (7.221.188.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 23 Nov 2022 14:04:10 +0800 From: Kemeng Shi To: , , CC: , , , Subject: [PATCH 09/11] blk-throttle: remove unnecessary check for validation of limit index Date: Wed, 23 Nov 2022 14:03:59 +0800 Message-ID: <20221123060401.20392-10-shikemeng@huawei.com> X-Mailer: git-send-email 2.14.1.windows.1 In-Reply-To: <20221123060401.20392-1-shikemeng@huawei.com> References: <20221123060401.20392-1-shikemeng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.178.129] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500016.china.huawei.com (7.221.188.220) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org We always keep limit index valid as following: Max limit is always valid and low limit can only be invalidated in blk_throtl_update_limit_valid. Each time low limit may become invalid after blk_throtl_update_limit_valid is called, we will check and make sure current limit index is valid. It's reasonable to always keep limit index valid, so we can remove this check. Signed-off-by: Kemeng Shi --- block/blk-throttle.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 3eccc7af4368..6f509cadd92b 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -418,12 +418,10 @@ static void tg_update_has_rules(struct throtl_grp *tg) for (rw = READ; rw <= WRITE; rw++) { tg->has_rules_iops[rw] = (parent_tg && parent_tg->has_rules_iops[rw]) || - (td->limit_valid[td->limit_index] && - tg_iops_limit(tg, rw) != UINT_MAX); + (tg_iops_limit(tg, rw) != UINT_MAX); tg->has_rules_bps[rw] = (parent_tg && parent_tg->has_rules_bps[rw]) || - (td->limit_valid[td->limit_index] && - (tg_bps_limit(tg, rw) != U64_MAX)); + (tg_bps_limit(tg, rw) != U64_MAX); } } -- 2.30.0