Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp382690pxb; Wed, 3 Mar 2021 05:50:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJwFAg4I/D9A6dVPFsufqLj+XPkzDuRbnpjV27FqpPPCKKx55sKdJgkTjN0XkNTx74H6+e X-Received: by 2002:a17:906:1848:: with SMTP id w8mr25395288eje.3.1614779444220; Wed, 03 Mar 2021 05:50:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614779444; cv=none; d=google.com; s=arc-20160816; b=IhQR/C7GspE+nHlFpwPKgfhQ7NnyeEg5mcACiye/M3PCeWbgIdHJ42SWOnPaihelco 9yXL2fYrm61CD3Lb5ucBIGN41ATlUkw32u6cmOVHv/nn1G0PIySW+4i3SLadOTGnbf0Q Y9gBzPwt9/dVWC6pA2zXRi828ngsLWgtBBAKjGvPYNMD4YFhhfTUh+J4KfISZJ/ivUia izEWaf5LNYJq2DoWon88a7NxUQozWxu2R1yCf/k/jJwnLyJweQ8IkC1iEnryV0opYnN3 tAowUj3e0b10i9rZeFqb8psy2U5yjpten4SOPg+8s4PmRlrqawVtK8mTt3n63lcljo8K Xdfg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BaBR5GRg+00F5leJ7tq5UnT8KQouJCEQrL8uRwnQo7w=; b=UPLHDX6omwaxcD94HzYnb1pjWMVCEMsaZTvJcYckGxpyltKVdXkAcCcd3++9Ns6Nqk P8tFmoKobonXYUShpv937rwbkgn8Hw81IJCrVADhEEPUK7KyOLAuMgZ5GkNc40pGUKuT U/g3NteGVmDwXbiWu/F/7srsYp+RojmrmJtFQiUrYxyH/poJJMhS2/3yEP/Lp7DLfdN3 /5afYgffrIHG29dpfUTddsOHrzEVcS+rWWBMNd1NV522JlHvt4n4AfOCjrGWLN4O27YB Xtu1QcZxTXuM2mE+Am2rVcTnR7oX0fp4Yhbtb1vFc8KvjX9yco64w7JeX7Dgi31UV3JJ cD5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EVb5dKb/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si9693521ejz.5.2021.03.03.05.50.12; Wed, 03 Mar 2021 05:50:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EVb5dKb/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242469AbhCATxi (ORCPT + 99 others); Mon, 1 Mar 2021 14:53:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:59158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236168AbhCAQ6K (ORCPT ); Mon, 1 Mar 2021 11:58:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 56F8064FD7; Mon, 1 Mar 2021 16:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614616597; bh=qtdWE0eSQAk6aunNhppWgdFTnIAOv1hk3BbPYWeySrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EVb5dKb/GZ+RfBsmSndzpc2HR6IYP9fvlaZBLdhmxMLfQrx3NDRuFMn3wm8Co9o2d ZSNrTqds6b6+lVs1shl6ogYaQmuaH7WQJKHcEdWOqjmi1t/epVJ6z1RGoX4PXszoeQ EK82awe9zRor9mXKA1khi40Td0qVK5mTjgveg7pI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Hannes Reinecke , Mike Snitzer , Bart Van Assche , Ming Lei , Jens Axboe , Jack Wang Subject: [PATCH 4.19 008/247] block: add helper for checking if queue is registered Date: Mon, 1 Mar 2021 17:10:28 +0100 Message-Id: <20210301161032.100161958@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ming Lei commit 58c898ba370e68d39470cd0d932b524682c1f9be upstream. There are 4 users which check if queue is registered, so add one helper to check it. Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Greg KH Cc: Mike Snitzer Cc: Bart Van Assche Reviewed-by: Bart Van Assche Signed-off-by: Ming Lei Signed-off-by: Jens Axboe Signed-off-by: Jack Wang Signed-off-by: Greg Kroah-Hartman --- block/blk-sysfs.c | 4 ++-- block/blk-wbt.c | 2 +- block/elevator.c | 2 +- include/linux/blkdev.h | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -896,7 +896,7 @@ int blk_register_queue(struct gendisk *d if (WARN_ON(!q)) return -ENXIO; - WARN_ONCE(test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags), + WARN_ONCE(blk_queue_registered(q), "%s is registering an already registered queue\n", kobject_name(&dev->kobj)); queue_flag_set_unlocked(QUEUE_FLAG_REGISTERED, q); @@ -973,7 +973,7 @@ void blk_unregister_queue(struct gendisk return; /* Return early if disk->queue was never registered. */ - if (!test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags)) + if (!blk_queue_registered(q)) return; /* --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -708,7 +708,7 @@ void wbt_enable_default(struct request_q return; /* Queue not registered? Maybe shutting down... */ - if (!test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags)) + if (!blk_queue_registered(q)) return; if ((q->mq_ops && IS_ENABLED(CONFIG_BLK_WBT_MQ)) || --- a/block/elevator.c +++ b/block/elevator.c @@ -1083,7 +1083,7 @@ static int __elevator_change(struct requ struct elevator_type *e; /* Make sure queue is not in the middle of being removed */ - if (!test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags)) + if (!blk_queue_registered(q)) return -ENOENT; /* --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -743,6 +743,7 @@ bool blk_queue_flag_test_and_clear(unsig #define blk_queue_quiesced(q) test_bit(QUEUE_FLAG_QUIESCED, &(q)->queue_flags) #define blk_queue_pm_only(q) atomic_read(&(q)->pm_only) #define blk_queue_fua(q) test_bit(QUEUE_FLAG_FUA, &(q)->queue_flags) +#define blk_queue_registered(q) test_bit(QUEUE_FLAG_REGISTERED, &(q)->queue_flags) extern void blk_set_pm_only(struct request_queue *q); extern void blk_clear_pm_only(struct request_queue *q);