From patchwork Fri Aug 10 20:28:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10563137 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 7B65B157B for ; Fri, 10 Aug 2018 20:28:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A21C2A73C for ; Fri, 10 Aug 2018 20:28:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE1692A817; Fri, 10 Aug 2018 20:28:10 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 CAAE22A73C for ; Fri, 10 Aug 2018 20:28:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727146AbeHJW7c (ORCPT ); Fri, 10 Aug 2018 18:59:32 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:3370 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726781AbeHJW7c (ORCPT ); Fri, 10 Aug 2018 18:59:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1533932889; x=1565468889; h=from:to:cc:subject:date:message-id; bh=xDT8sJwi7S4LcaHGrsrCoNvEP7i5Ilxyo0+tZHG8/R4=; b=aZnvRUX+UAsV2J9gp5D/BVG+4ldvSgSKLOf4hAKI6+yawpza09qdi0CZ FtJvuHjhxIabyqGeynQrntclgegYxmiyyYDDf25uyyObrdmiEOsE4m8M1 W2VzcCiTYUWZWacu/q4B6T1RZ3iHMANpql/qUay/oERK894mQew4z+gAn wVwplcA+l32sxOjwVik8nm3Sqw0PNvlFRyPmparC/djwLAVhPAH29SqO4 mmm/fZDaQ21jhFCwN4f5n0ZoZoJUstXcwLPKFwiWV6JJEF0GXVwoIO3Ge //5E+SIk996FVIVJqSazqa/iWnvdl+P2+cgAZK9Shg5ORZyLpsINg7aLD A==; X-IronPort-AV: E=Sophos;i="5.53,221,1531756800"; d="scan'208";a="91043960" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 11 Aug 2018 04:28:08 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Aug 2018 13:15:42 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip02.wdc.com with ESMTP; 10 Aug 2018 13:28:07 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Tejun Heo Subject: [PATCH] blkcg: Make blkg_root_lookup() work for queues in bypass mode Date: Fri, 10 Aug 2018 13:28:07 -0700 Message-Id: <20180810202807.14620-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 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 legacy queues the only call of blkg_root_lookup() happens after bypass mode has been enabled. Since blkg_lookup() returns NULL for queues in bypass mode, modify the blkg_root_lookup() such that it no longer depends on bypass mode. Rename the function into blk_queue_root_blkg() as suggested by Tejun. Suggested-by: Tejun Heo Fixes: 6bad9b210a22 ("blkcg: Introduce blkg_root_lookup()") Signed-off-by: Bart Van Assche Cc: Tejun Heo --- block/blk-sysfs.c | 2 +- include/linux/blk-cgroup.h | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index fcadea471779..1bec13c4eb88 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -813,7 +813,7 @@ static void __blk_release_queue(struct work_struct *work) blk_exit_queue(q); } - WARN(blkg_root_lookup(q), + WARN(blk_queue_root_blkg(q), "request queue %p is being released but it has not yet been removed from the blkcg controller\n", q); diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 2b08616dcc11..30bbe053627c 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -344,20 +344,14 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, } /** - * blkg_lookup - look up blkg for the specified request queue + * blk_queue_root_blkg - return blkg for the (blkcg_root, @q) pair * @q: request_queue of interest * * Lookup blkg for @q at the root level. See also blkg_lookup(). */ -static inline struct blkcg_gq *blkg_root_lookup(struct request_queue *q) +static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q) { - struct blkcg_gq *blkg; - - rcu_read_lock(); - blkg = blkg_lookup(&blkcg_root, q); - rcu_read_unlock(); - - return blkg; + return q->root_blkg; } /** @@ -883,7 +877,8 @@ static inline bool blk_cgroup_congested(void) { return false; } static inline void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay) { } static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; } -static inline struct blkcg_gq *blkg_root_lookup(struct request_queue *q) { return NULL; } +static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q) +{ return NULL; } static inline int blkcg_init_queue(struct request_queue *q) { return 0; } static inline void blkcg_drain_queue(struct request_queue *q) { } static inline void blkcg_exit_queue(struct request_queue *q) { }