From patchwork Wed Feb 27 06:21:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yufen Yu X-Patchwork-Id: 10831253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A85DB17E9 for ; Wed, 27 Feb 2019 06:19:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 253852C703 for ; Wed, 27 Feb 2019 06:19:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18F382CAF5; Wed, 27 Feb 2019 06:19:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACAEC2C703 for ; Wed, 27 Feb 2019 06:19:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729729AbfB0GRn (ORCPT ); Wed, 27 Feb 2019 01:17:43 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:4175 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729529AbfB0GRn (ORCPT ); Wed, 27 Feb 2019 01:17:43 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1E231E2EEA4FB55483CC; Wed, 27 Feb 2019 14:17:42 +0800 (CST) Received: from huawei.com (10.90.53.225) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.408.0; Wed, 27 Feb 2019 14:17:40 +0800 From: Yufen Yu To: , Subject: [PATCH] block: add a new flag BLK_MQ_POLL_HYBRID_INVALID for hybrid poll Date: Wed, 27 Feb 2019 14:21:55 +0800 Message-ID: <20190227062155.19732-1-yuyufen@huawei.com> X-Mailer: git-send-email 2.16.2.dirty MIME-Version: 1.0 X-Originating-IP: [10.90.53.225] X-CFilter-Loop: Reflected Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For q->poll_nsec == -1, means using classic poll, not hybrid poll. We introduce a new flag BLK_POLL_DELAY_INVALID to replace -1, which may make code much easier to read. Signed-off-by: Yufen Yu --- block/blk-mq.c | 4 ++-- block/blk-sysfs.c | 4 ++-- include/linux/blkdev.h | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 9437a5eb07cf..8df9f6e97d2e 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2857,7 +2857,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, /* * Default to classic polling */ - q->poll_nsec = -1; + q->poll_nsec = BLK_MQ_POLL_HYBRID_INVALID; blk_mq_init_cpu_queues(q, set->nr_hw_queues); blk_mq_add_queue_tag_set(set, q); @@ -3389,7 +3389,7 @@ static bool blk_mq_poll_hybrid(struct request_queue *q, { struct request *rq; - if (q->poll_nsec == -1) + if (q->poll_nsec == BLK_MQ_POLL_HYBRID_INVALID) return false; if (!blk_qc_t_is_internal(cookie)) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 590d1ef2f961..8775b898f96d 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -360,7 +360,7 @@ static ssize_t queue_poll_delay_show(struct request_queue *q, char *page) { int val; - if (q->poll_nsec == -1) + if (q->poll_nsec == BLK_MQ_POLL_HYBRID_INVALID) val = -1; else val = q->poll_nsec / 1000; @@ -381,7 +381,7 @@ static ssize_t queue_poll_delay_store(struct request_queue *q, const char *page, return err; if (val == -1) - q->poll_nsec = -1; + q->poll_nsec = BLK_MQ_POLL_HYBRID_INVALID; else q->poll_nsec = val * 1000; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 338604dff7d0..2102447b67d9 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -50,6 +50,9 @@ struct blk_stat_callback; /* Must be consistent with blk_mq_poll_stats_bkt() */ #define BLK_MQ_POLL_STATS_BKTS 16 +/* Using default classic polling */ +#define BLK_MQ_POLL_HYBRID_INVALID -1 + /* * Maximum number of blkcg policies allowed to be registered concurrently. * Defined here to simplify include dependency.