Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2322241rwb; Wed, 30 Nov 2022 05:22:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf6owGEzu2pw4kN0SM78MnB32+VEG1j1FGLw5rCBJl3Amch1QjWrkTSnjcT1wfExS/OzzCm2 X-Received: by 2002:a63:5d58:0:b0:476:ffc7:f7b with SMTP id o24-20020a635d58000000b00476ffc70f7bmr36783481pgm.271.1669814537719; Wed, 30 Nov 2022 05:22:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669814537; cv=none; d=google.com; s=arc-20160816; b=hpDrGLIvTSyXfYHFEZE0jskh75d+Xs/K06YxXlN6WkKkr4pgzHiHQoxvBTpi7hagq0 zcMf5h4y3pNrwR5Q8NJd4iRVLGz7owbEzALRiyOYatUV7Mht5Fy+JavYqQ/WSstHLK9H JsubNbTuHcZtVVOxYC2KhdobAzVgVUMq9+FEtOt6rctycYlaY2c1uOWYwjn/3PMfuj8Z oELloBLC+F1sLf4fW3fCHUzUvOqkmr5QTNKudaTiaLU5UYH9uskuAMJl/AuA0bgQmtOH enhFtKcXxxnOFjjPYoaVPeo56Q7ubIp/kFO+FvoQFojWAYQazcqUIcPW2Kv8n22udZMb 6zkw== 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=qSGPpAeMHdhGdSPUdAuwqISEZzXZdbV1SbxrmU5JVeM=; b=SvDx8vC8EYJV4Sx/8j+ZgeMS63MVGNOzogES7frHUHFhM1IygxKIjbBgfglrgvEaZf MzvZImhAbahH1qygsgbzzQvXSDfYno3YHvyzu2PyhvBlpwkjrnCv6ak3JaEmo79pDdvR BloASdFsSv+CuFphTC31ZdarRhtyu2F2UZfahW0OBxNrLAUzRPjIYJFeflU8WZgbvCi/ Uzn2VD/tMi81QRdtwU5GAj+iNJMfmWzdnzOsU9/Nm4mrfjRiNOrxu+e0sqiWcE1m5gsD K7AKo+88eh6Wvidjtnug3y52zIIFdqeQNuMNTZ+VezD0l95wW1xBGDxWhCRWbwib2kSS 0pXQ== 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 h9-20020a17090adb8900b00212de1542cesi1455049pjv.92.2022.11.30.05.22.06; Wed, 30 Nov 2022 05:22:17 -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 S235628AbiK3NBR (ORCPT + 84 others); Wed, 30 Nov 2022 08:01:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbiK3NA5 (ORCPT ); Wed, 30 Nov 2022 08:00:57 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C60874B99D; Wed, 30 Nov 2022 05:00:54 -0800 (PST) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NMfSX2fc4z15Mxy; Wed, 30 Nov 2022 21:00:12 +0800 (CST) Received: from dggpeml500003.china.huawei.com (7.185.36.200) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 30 Nov 2022 21:00:52 +0800 Received: from huawei.com (10.175.127.227) by dggpeml500003.china.huawei.com (7.185.36.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 30 Nov 2022 21:00:51 +0800 From: Li Nan To: , , CC: , , , , , Subject: [PATCH -next v2 3/9] blk-iocost: don't allow to configure bio based device Date: Wed, 30 Nov 2022 21:21:50 +0800 Message-ID: <20221130132156.2836184-4-linan122@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221130132156.2836184-1-linan122@huawei.com> References: <20221130132156.2836184-1-linan122@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: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500003.china.huawei.com (7.185.36.200) 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 From: Yu Kuai iocost is based on rq_qos, which can only work for request based device, thus it doesn't make sense to configure iocost for bio based device. Signed-off-by: Yu Kuai Reviewed-by: Christoph Hellwig Signed-off-by: Li Nan --- block/blk-iocost.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index c532129a1456..bc6522bb314d 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -3181,6 +3181,11 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input, return PTR_ERR(bdev); disk = bdev->bd_disk; + if (!queue_is_mq(disk->queue)) { + ret = -EOPNOTSUPP; + goto out; + } + ioc = q_to_ioc(disk->queue); if (!ioc) { ret = blk_iocost_init(disk); @@ -3364,6 +3369,11 @@ static ssize_t ioc_cost_model_write(struct kernfs_open_file *of, char *input, return PTR_ERR(bdev); q = bdev_get_queue(bdev); + if (!queue_is_mq(q)) { + ret = -EOPNOTSUPP; + goto out; + } + ioc = q_to_ioc(q); if (!ioc) { ret = blk_iocost_init(bdev->bd_disk); -- 2.31.1