From patchwork Wed Nov 30 13:21:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Nan X-Patchwork-Id: 27784 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp909194wrr; Wed, 30 Nov 2022 05:02:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf5AtXOmfrWC+X/6pnk9jfwwJwxYhQyIZyr946JNmSSwB771sjhILMIrQm64V/O99F7Z7l2H X-Received: by 2002:a17:902:d592:b0:186:8930:20e6 with SMTP id k18-20020a170902d59200b00186893020e6mr42773604plh.64.1669813323265; Wed, 30 Nov 2022 05:02:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669813323; cv=none; d=google.com; s=arc-20160816; b=HS5xFnZ904i5Y/qm6df3/LXBYJeuH5VuaV3fllVDefTX9G2ab9uDWKWlVWNF3AHdfV 7h9jYTBhzyVJPbmu8v7mivFTpa8Ze8KNMFIJC6I0qpl/w3qluDyU2lze2uopK/F0HGrM u2NPc6TMfSuugv9cQx3esU+EU6PLaMhPnjLT8M2x6h4Ipn07/UcXMCwCOKNr5zmwFw95 FfHZn4OFfkmDeF5FILsBV0Hn7sNyqZy/PI3IX08SswiO+w6qf89XnSrKiovmBxY1rp1A 36zVCGRcYPndfO6eYQV2ioPcv7hg7bEPcK91ME4axBpdR6X11UU7aWzkkYROhS+j9kt6 Dg5A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a056a0008ce00b0055706edd79csi1637338pfu.240.2022.11.30.05.01.49; Wed, 30 Nov 2022 05:02:03 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750926175119622108?= X-GMAIL-MSGID: =?utf-8?q?1750926175119622108?= 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 Acked-by: Tejun Heo --- 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);