Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp15131388rwb; Mon, 28 Nov 2022 08:16:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf4evbxeAxM/5laWT4uEcQ2qnHSCmeuEf7+3AV+cHuSdZR+OcaC/5tca9ut2qyqISPxkXmhG X-Received: by 2002:a2e:bf27:0:b0:279:74ab:77bd with SMTP id c39-20020a2ebf27000000b0027974ab77bdmr9082960ljr.380.1669652175744; Mon, 28 Nov 2022 08:16:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669652175; cv=none; d=google.com; s=arc-20160816; b=rpIqAXFmj6E4vAX9YGelrIchGqqdgJDrIBKiisXBJPEytklASSwlUphI7Wd/WdJQVv YarYsuUsEH7kjeyPGj6jcTmzNvL2qggFs2gwagwRqs9t9bFOOEVfG4+srzZiWgdgTzXe esaTIYR6qgUZj7mLadEXhcxLIzN+xRGKSpWv0E3i8D0tYMyJRUGqJGSlrbFVoQtz2Swb uVRgZOLNZe5h8JCPzqFaJoCzq5HaUOyjT0rTXRLa5U95GLJMRofrMa0LxhqYm2E5hgNV /JFVzhN5J5Lz5XOydUbU0HGeKULCjnoEvqqdnBkYFXBS5cNFiexc2onkXWqeysoxueXL Lbqg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020a05640206ce00b004661ece3fabsi9402769edy.575.2022.11.28.08.15.46; Mon, 28 Nov 2022 08:16:15 -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 + 84 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 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); -- 2.31.1