From patchwork Wed May 2 21:32:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10376669 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 EFACE6037D for ; Wed, 2 May 2018 21:33:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFD4F27E01 for ; Wed, 2 May 2018 21:33:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4D4627F7F; Wed, 2 May 2018 21:33:19 +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 DFB5D28E00 for ; Wed, 2 May 2018 21:33:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751645AbeEBVdF (ORCPT ); Wed, 2 May 2018 17:33:05 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:42475 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751585AbeEBVdE (ORCPT ); Wed, 2 May 2018 17:33:04 -0400 Received: by mail-pf0-f194.google.com with SMTP id p14so1496682pfh.9 for ; Wed, 02 May 2018 14:33:04 -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=W7AKxHWG0DlPfYOLlTgawZ0o07nWIVYAxjptpo59q35FXAP4+er1S8uTKOqQOdeLH1 mV2XlARQda7AahjNUpkDBlfMv/uyEMYh/L9uYSsIG5GvysiR+KOwG24XxHsSFSm3pcwQ nndzZotCkto7BfS7HaDZMOAS998E5V7dO0+DzzAytf4DweZOD8QBIz0W6Ebk5YOFd+SC 4MndYtfbrKi456ewUQIqSmXDGvZXxw++awdbwSotcsn8DgOCB7wTXWFp5i5FP/Vu2wDc WsuJj8nWWNPTLFPa6dkP6vP3FZyXdBnSwwjIMlmUtmJRuHOU7tJNvDzmrLU+prr9FNwD e9vw== 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=QHKIZd2XIcSSL4q1nPom9AKsnhmFwlnlpAG43H0i0uG7XYov4ITwCU8BJyZXniuokn jMDRVMlS/cu3K8Y+XIo0am6zq27hV/F7Es7jAFU02tGciJQJWO58N1JkZXGWD1JxAYTP 8Pw2DRzcQxXv0FfBwATzLk3FRp2C8ydF2CNn6whC3/X3Z1Xb3Z/ymo5tIf5PkkMRJfE/ 0DM7Fjaq6nOsvjtlu7YTP3ZolH5jpgunoOJZwVCUnczb8HnLRikQ5MYjbs1PM74VmMaw 725WX19S2Ku8salEYOXVh/r6C9RwFX+/ZLn4OFUtu5ptD4b3hO/rleBs2RLXjXol/yNm uT0A== X-Gm-Message-State: ALQs6tAGWHOsC0W4cqEsKEKskm+8ixbveyfCXnONqk2EZqZp5pgqr+5s KyACJTyWCYqYLv1XqeY8uNh8DAGnWi4= X-Google-Smtp-Source: AB8JxZotJVcnA2m91/aRjeZeI5yV4VwAappuSE/uhXjLzTBOWRZ5GbFhFaHFGTmBXBjGFs4+R2gObw== X-Received: by 2002:a65:5d8e:: with SMTP id f14-v6mr17676052pgt.25.1525296783365; Wed, 02 May 2018 14:33:03 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:180::1:24e1]) by smtp.gmail.com with ESMTPSA id s6-v6sm9640492pgq.19.2018.05.02.14.33.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 May 2018 14:33:02 -0700 (PDT) From: Omar Sandoval To: linux-block@vger.kernel.org Cc: Jens Axboe , kernel-team@fb.com, Josef Bacik Subject: [PATCH v2 1/7] block: move some wbt helpers to blk-wbt.c Date: Wed, 2 May 2018 14:32:39 -0700 Message-Id: <13f91069b511243a6245f091e9f0b8ce566daa0d.1525296089.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) { }