Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp628351rwb; Thu, 22 Sep 2022 04:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78E2EH/0o61YWJdB9rPjA/uUFOSWqW3xl5sTrb2LnrWyxMzd675VH0LXRSkeQ2OuZZqzO7 X-Received: by 2002:a17:907:6e9f:b0:780:b046:fb40 with SMTP id sh31-20020a1709076e9f00b00780b046fb40mr2316287ejc.256.1663846589544; Thu, 22 Sep 2022 04:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663846589; cv=none; d=google.com; s=arc-20160816; b=FKaoOwOTA4aB8S2mDEDW7STiKh1SdwWWFYIYJJ5vnd14wv6gvHRYFgKpeNpmds91NN cWpsI8+gvQIMbdPCagpX11KmOWUBlXjDRmEcj57dP53JUwe1nsMv9lBNWwElVHj3P0De FkBdmgUSzkwe5pD0Od85C8jCpItp51g2vJtjDREEc7qLsv0UD1uzjDddPZxwz/fIHM1B jlJr9JnM0G5dX+Vk+oftl8Ryn/SJLWsIVdHMtzMZr5YAOsuYN90NPULWrOjThF9xix73 jbpOkX/MhYrgoMPMbZoh/ivrq90EMynGF12UjanUStbXPM83/QDeApuDheKjeX+kSllr JXQw== 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=LaeZBViZNOalJ6cMGCnAe+HB2EizjY2/D1tzTG0O+iM=; b=QNJzMg/SL3sSwkKCcK4eGWAX5MpvPFKOWFaVQXO0lT7IYZeNWSy8xE4b4qSHGJXWW2 EoqBaxX2SYnb3hI9Ufj5bMA/B/OUulb3T08DOG25bckCAFRg5MvUrMZ/NpH1GkylwbZ/ 4JbBW7S2UnDz/GFprkafC3EHk2zev8ppvUivW2PLu3TEzxQSRSJQnHK/ZdnTtWVAWzJu RD51uqwmCBdoLaBgE+7Gj7Gdv2FMR4Gici0bgEJ7lE68dPlntYlUnpHyuu2v0kLfTTFe GoPy6+EJ1p+o8TxzkbBNPyY7i3/1h1IZMbeYvvmHxNg1zcJPys6KhVnhyGobURFlFjcj pSjA== 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 gv26-20020a170906f11a00b0077ef3eeca17si4561252ejb.155.2022.09.22.04.36.02; Thu, 22 Sep 2022 04:36:29 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231577AbiIVLZk (ORCPT + 99 others); Thu, 22 Sep 2022 07:25:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231442AbiIVLZQ (ORCPT ); Thu, 22 Sep 2022 07:25:16 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6587AE9FB; Thu, 22 Sep 2022 04:25:14 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MYCYV6czGzpStk; Thu, 22 Sep 2022 19:22:22 +0800 (CST) Received: from kwepemm600009.china.huawei.com (7.193.23.164) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 22 Sep 2022 19:25:12 +0800 Received: from huawei.com (10.175.127.227) by kwepemm600009.china.huawei.com (7.193.23.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 22 Sep 2022 19:25:11 +0800 From: Yu Kuai To: , , CC: , , , , Subject: [PATCH v3 2/5] elevator: add new field flags in struct elevator_queue Date: Thu, 22 Sep 2022 19:35:55 +0800 Message-ID: <20220922113558.1085314-3-yukuai3@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220922113558.1085314-1-yukuai3@huawei.com> References: <20220922113558.1085314-1-yukuai3@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600009.china.huawei.com (7.193.23.164) 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 There are only one flag to indicate that elevator is registered currently, prepare to add a flag to disable wbt if default elevator is bfq. Signed-off-by: Yu Kuai --- block/elevator.c | 6 ++---- block/elevator.h | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/block/elevator.c b/block/elevator.c index c319765892bb..7cb61820cfa0 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -512,7 +512,7 @@ int elv_register_queue(struct request_queue *q, bool uevent) if (uevent) kobject_uevent(&e->kobj, KOBJ_ADD); - e->registered = 1; + set_bit(ELEVATOR_FLAG_REGISTERED, &e->flags); } return error; } @@ -523,13 +523,11 @@ void elv_unregister_queue(struct request_queue *q) lockdep_assert_held(&q->sysfs_lock); - if (e && e->registered) { + if (e && test_and_clear_bit(ELEVATOR_FLAG_REGISTERED, &e->flags)) { struct elevator_queue *e = q->elevator; kobject_uevent(&e->kobj, KOBJ_REMOVE); kobject_del(&e->kobj); - - e->registered = 0; } } diff --git a/block/elevator.h b/block/elevator.h index 3f0593b3bf9d..ed574bf3e629 100644 --- a/block/elevator.h +++ b/block/elevator.h @@ -100,10 +100,12 @@ struct elevator_queue void *elevator_data; struct kobject kobj; struct mutex sysfs_lock; - unsigned int registered:1; + unsigned long flags; DECLARE_HASHTABLE(hash, ELV_HASH_BITS); }; +#define ELEVATOR_FLAG_REGISTERED 0 + /* * block elevator interface */ -- 2.31.1