From patchwork Wed May 2 17:34:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10376123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0CC70603B4 for ; Wed, 2 May 2018 17:34:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F284A28CC9 for ; Wed, 2 May 2018 17:34:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F12E228F2A; Wed, 2 May 2018 17:34:43 +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,DKIM_SIGNED, DKIM_VALID, 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 8D0E228CC9 for ; Wed, 2 May 2018 17:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751078AbeEBRem (ORCPT ); Wed, 2 May 2018 13:34:42 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:41209 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750925AbeEBRel (ORCPT ); Wed, 2 May 2018 13:34:41 -0400 Received: by mail-pg0-f68.google.com with SMTP id m21-v6so11132319pgv.8 for ; Wed, 02 May 2018 10:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Hzfl2FUBZr8/e016PY8ZR3EQgusVAVij2UyhRf7pd54=; b=y8yIUnen4095t2NWJFUlDz34+g+0kAxmHR/6/qa09Gf85Gq0VE/KhqY8GADIlhgs1b o+3XonmywKmI+NKiS/MA7H3AVqrpEt6c44PMgolA5LujzuOClK39ye4ylCgIs29/HToz RK309ABYimQ1xlH7H6tNMniOrgJvUac2+FrzpM1lCiks7xGnL0MSIferkI9JROzw0n3R 4WZjQz9k0j/7dmVblmiRulBgwV8k0MKKUwgw8oi8FJ4ETvbpcZW2AG18f4uhcJyNxvjC LK6gaIs5wBc6EgN0Vpo/YnNevVu1XGCndsfAQq0+y++S4svkGTLJ9c93xjtjFNZhfIwp DTLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Hzfl2FUBZr8/e016PY8ZR3EQgusVAVij2UyhRf7pd54=; b=KjwO6tFYmPYxlfuMTlbRfH9/HqW7zrdlgHglMPzalJRLrKzlmJ0yc9V2p8eryyjgwJ WGZleWhak8mAGn8qpmdFelZycGpxeQvpISC7HGCQ3YuWIAihQ3/9+i9HlTZdS8y8i4fX jnz9qhqcRJCNTPGSxM8JxfThbr8muXlFQIcH+iIwB1l8ATJgN3rwkOXnUiAzk1XS0xPD GOvmT+QepWEZvhu8w5LG7OlB3HI4jfgikur45YEycH2XnzEfv7W4xdrvTtC6zBDtbtUM mimy1aSwEVVK/Xyo0U6HACSbYey7EZGAtrc+B/UkvTTysAh5/lZjPvi+KwJZ/O5i2rK8 QVnA== X-Gm-Message-State: ALQs6tDHFEgfASu7HIgF4WnQANj7K2pD/chK8EXdrHeR+9p5KpnmYFpC rG16snHmF/qAOpn9eI11k5lUhciN8uY= X-Google-Smtp-Source: AB8JxZq9iIE41Lg+r2KjZlHFb9Zd0UnjGYjJfBX/r0er7qZvJlzWhspTUIHrQorvFjbJUVuM4htSFA== X-Received: by 10.98.182.16 with SMTP id j16mr20093071pff.17.1525282480753; Wed, 02 May 2018 10:34:40 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:180::1:24e1]) by smtp.gmail.com with ESMTPSA id w184-v6sm17757388pgb.20.2018.05.02.10.34.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 May 2018 10:34:39 -0700 (PDT) From: Omar Sandoval To: linux-block@vger.kernel.org Cc: Jens Axboe , kernel-team@fb.com Subject: [PATCH 1/7] block: move some wbt helpers to blk-wbt.c Date: Wed, 2 May 2018 10:34:20 -0700 Message-Id: <13f91069b511243a6245f091e9f0b8ce566daa0d.1525282392.git.osandov@fb.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: 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 From: Omar Sandoval A few helpers are only used from blk-wbt.c, so move them there, and put wbt_track() behind the CONFIG_BLK_WBT typedef. This is in preparation for changing how the wbt flags are tracked. Signed-off-by: Omar Sandoval --- block/blk-wbt.c | 20 ++++++++++++++++++++ block/blk-wbt.h | 33 ++++++++------------------------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/block/blk-wbt.c b/block/blk-wbt.c index f92fc84b5e2c..030d6bdcaa4c 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -29,6 +29,26 @@ #define CREATE_TRACE_POINTS #include +static inline void wbt_clear_state(struct blk_issue_stat *stat) +{ + stat->stat &= ~BLK_STAT_RES_MASK; +} + +static inline enum wbt_flags wbt_stat_to_mask(struct blk_issue_stat *stat) +{ + return (stat->stat & BLK_STAT_RES_MASK) >> BLK_STAT_RES_SHIFT; +} + +static inline bool wbt_is_tracked(struct blk_issue_stat *stat) +{ + return (stat->stat >> BLK_STAT_RES_SHIFT) & WBT_TRACKED; +} + +static inline bool wbt_is_read(struct blk_issue_stat *stat) +{ + return (stat->stat >> BLK_STAT_RES_SHIFT) & WBT_READ; +} + enum { /* * Default setting, we'll scale up (to 75% of QD max) or down (min 1) diff --git a/block/blk-wbt.h b/block/blk-wbt.h index a232c98fbf4d..d3f47a721aec 100644 --- a/block/blk-wbt.h +++ b/block/blk-wbt.h @@ -31,31 +31,6 @@ enum { WBT_STATE_ON_MANUAL = 2, }; -static inline void wbt_clear_state(struct blk_issue_stat *stat) -{ - stat->stat &= ~BLK_STAT_RES_MASK; -} - -static inline enum wbt_flags wbt_stat_to_mask(struct blk_issue_stat *stat) -{ - return (stat->stat & BLK_STAT_RES_MASK) >> BLK_STAT_RES_SHIFT; -} - -static inline void wbt_track(struct blk_issue_stat *stat, enum wbt_flags wb_acct) -{ - stat->stat |= ((u64) wb_acct) << BLK_STAT_RES_SHIFT; -} - -static inline bool wbt_is_tracked(struct blk_issue_stat *stat) -{ - return (stat->stat >> BLK_STAT_RES_SHIFT) & WBT_TRACKED; -} - -static inline bool wbt_is_read(struct blk_issue_stat *stat) -{ - return (stat->stat >> BLK_STAT_RES_SHIFT) & WBT_READ; -} - struct rq_wait { wait_queue_head_t wait; atomic_t inflight; @@ -109,6 +84,11 @@ static inline unsigned int wbt_inflight(struct rq_wb *rwb) #ifdef CONFIG_BLK_WBT +static inline void wbt_track(struct blk_issue_stat *stat, enum wbt_flags flags) +{ + stat->stat |= ((u64)flags) << BLK_STAT_RES_SHIFT; +} + void __wbt_done(struct rq_wb *, enum wbt_flags); void wbt_done(struct rq_wb *, struct blk_issue_stat *); enum wbt_flags wbt_wait(struct rq_wb *, struct bio *, spinlock_t *); @@ -127,6 +107,9 @@ u64 wbt_default_latency_nsec(struct request_queue *); #else +static inline void wbt_track(struct blk_issue_stat *stat, enum wbt_flags flags) +{ +} static inline void __wbt_done(struct rq_wb *rwb, enum wbt_flags flags) { }