From patchwork Mon Nov 28 15:44:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Nan X-Patchwork-Id: 26825 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5750220wrr; Mon, 28 Nov 2022 07:28:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf44PsjrzFmma1221lHqlLcGyn8yc8OgP/ZnKpinMdkJIWIjZB7N8/NIONk6U963DoysiQLq X-Received: by 2002:a17:906:2c51:b0:7b2:8c66:9bda with SMTP id f17-20020a1709062c5100b007b28c669bdamr2636933ejh.732.1669649291246; Mon, 28 Nov 2022 07:28:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669649291; cv=none; d=google.com; s=arc-20160816; b=VMQ2rE4h57yHy+HI2pfvHehuVFdTbYYp6Z4NvG3zTxY04L5kWyU9z/kwr6FWGK58pI L58B6ybQnHCHzu+BTZNFjHoVmlwoZ7EqOsSkYD4YcKZ0wf6nDzjdRow6SjnXpwy9PBb5 wfgTWZU45OGvDeQRloROBmbE70KfnKRq6tzNYu4rJdr0o7+CRds8ZrM5hHxJT33Z7BNt bYh5DhNEmtIetdrvesJC89CHOBvF9kFSzKZhGafn0+junED1uv3Yoc/rBy/6mzhWwyg2 81NU3w0pTzkkEQoAKF/+i+S8AFsWGjztdQN0GzxrwqWoZg+JsmMNl/nWjxNsxvFHWmDT 0DxA== 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=Npf3kO5j+EBCYK1BXyvBfU//cZc97bL1ktTKSm5ysKg=; b=MRCzNE45t1lHOthEajaa8u3Fyk6jeLAbR2gQjPfqF4MJUj0sRNOs8vL0BPGnpZvBTa nXWG87LCrsSuvqFXhiNYvm01XUI2YoXSOr1pLeR4bJDOuF+zrSeGFIKSElgmPbT+VPjn W2Ael633mU3pTUNwybvSMFX1ihNfSyhZ0TbK1e8jC2MsKEfBB7EHjhzCyuECKbYwPzDm Zt5Qo7gaVZpUyXWIwknNOTgHRaTreHprXFnKUFgUZcjS60hUtzvMW1svYjBVnhSH7zeO EFJu491Dn8GoA3CzJHMvTmaTNtaxkTdpF1csCuiL7TZgyQdTEkZtDjVVE0AvD9KwZbHl l7WQ== 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 ib20-20020a1709072c7400b0079330b37fb6si7953920ejc.880.2022.11.28.07.27.44; Mon, 28 Nov 2022 07:28:11 -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 S231756AbiK1PXq (ORCPT + 99 others); Mon, 28 Nov 2022 10:23:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231468AbiK1PXc (ORCPT ); Mon, 28 Nov 2022 10:23:32 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 996A025EA; Mon, 28 Nov 2022 07:23:31 -0800 (PST) Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NLTft5ZFgzJnwS; Mon, 28 Nov 2022 23:20:06 +0800 (CST) Received: from dggpeml500003.china.huawei.com (7.185.36.200) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 28 Nov 2022 23:23:28 +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; Mon, 28 Nov 2022 23:23:27 +0800 From: Li Nan To: , , CC: , , , , , Subject: [PATCH -next 3/8] blk-iocost: don't allow to configure bio based device Date: Mon, 28 Nov 2022 23:44:29 +0800 Message-ID: <20221128154434.4177442-4-linan122@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221128154434.4177442-1-linan122@huawei.com> References: <20221128154434.4177442-1-linan122@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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?1750754175061193606?= X-GMAIL-MSGID: =?utf-8?q?1750754175061193606?= 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..2bfecc511dd9 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 = -EPERM; + 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 = -EPERM; + goto out; + } + ioc = q_to_ioc(q); if (!ioc) { ret = blk_iocost_init(bdev->bd_disk);