From patchwork Fri Nov 11 15:21:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9423147 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 966AA60484 for ; Fri, 11 Nov 2016 15:22:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 919B929B29 for ; Fri, 11 Nov 2016 15:22:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8504F29B86; Fri, 11 Nov 2016 15:22:09 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 1A85C29B88 for ; Fri, 11 Nov 2016 15:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753356AbcKKPWF (ORCPT ); Fri, 11 Nov 2016 10:22:05 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:49226 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756493AbcKKPWE (ORCPT ); Fri, 11 Nov 2016 10:22:04 -0500 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.17/8.16.0.17) with SMTP id uABFIXNp020658; Fri, 11 Nov 2016 07:22:01 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=KI7PWInKRvqeg408g3U19E8Bk1DJzsfCpGR9AYCrbmI=; b=hywgarX7fUKEMwHQgriyWj5+EDn5skWkOkSmchO2mCV/ReybW1iUsdfNq0DlznQiE+WE IGjfE1foe46U/kXP2+MZQlNtqqqN0boNS8EjVY2DflwudbNwGVAGZMkpUc3TayeKo6si IS04i/ms+U9cVg4kn2dt62sstYCIr/J2/TA= Received: from mail.thefacebook.com ([199.201.64.23]) by m0089730.ppops.net with ESMTP id 26nc0nj3b2-2 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 11 Nov 2016 07:22:01 -0800 Received: from localhost.localdomain (192.168.54.13) by mail.thefacebook.com (192.168.16.13) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 11 Nov 2016 07:21:59 -0800 From: Jens Axboe To: , CC: , Jens Axboe Subject: [PATCH 1/2] blk-wbt: store queue instead of bdi Date: Fri, 11 Nov 2016 08:21:56 -0700 Message-ID: <1478877717-19624-2-git-send-email-axboe@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478877717-19624-1-git-send-email-axboe@fb.com> References: <1478877717-19624-1-git-send-email-axboe@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.54.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-11_07:, , signatures=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 The bdi was a leftover from when the code was block layer agnostic. Now that we just support a block layer user, store the queue directly. Signed-off-by: Jens Axboe Reviewed-by: Jan Kara --- block/blk-wbt.c | 20 ++++++++++++-------- block/blk-wbt.h | 4 +--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 889c17ff8503..4ab9cebc8003 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -96,7 +96,7 @@ static void wb_timestamp(struct rq_wb *rwb, unsigned long *var) */ static bool wb_recent_wait(struct rq_wb *rwb) { - struct bdi_writeback *wb = &rwb->bdi->wb; + struct bdi_writeback *wb = &rwb->queue->backing_dev_info.wb; return time_before(jiffies, wb->dirty_sleep + HZ); } @@ -279,6 +279,7 @@ enum { static int __latency_exceeded(struct rq_wb *rwb, struct blk_rq_stat *stat) { + struct backing_dev_info *bdi = &rwb->queue->backing_dev_info; u64 thislat; /* @@ -293,7 +294,7 @@ static int __latency_exceeded(struct rq_wb *rwb, struct blk_rq_stat *stat) thislat = rwb_sync_issue_lat(rwb); if (thislat > rwb->cur_win_nsec || (thislat > rwb->min_lat_nsec && !stat[0].nr_samples)) { - trace_wbt_lat(rwb->bdi, thislat); + trace_wbt_lat(bdi, thislat); return LAT_EXCEEDED; } @@ -317,13 +318,13 @@ static int __latency_exceeded(struct rq_wb *rwb, struct blk_rq_stat *stat) * If the 'min' latency exceeds our target, step down. */ if (stat[0].min > rwb->min_lat_nsec) { - trace_wbt_lat(rwb->bdi, stat[0].min); - trace_wbt_stat(rwb->bdi, stat); + trace_wbt_lat(bdi, stat[0].min); + trace_wbt_stat(bdi, stat); return LAT_EXCEEDED; } if (rwb->scale_step) - trace_wbt_stat(rwb->bdi, stat); + trace_wbt_stat(bdi, stat); return LAT_OK; } @@ -338,7 +339,9 @@ static int latency_exceeded(struct rq_wb *rwb) static void rwb_trace_step(struct rq_wb *rwb, const char *msg) { - trace_wbt_step(rwb->bdi, msg, rwb->scale_step, rwb->cur_win_nsec, + struct backing_dev_info *bdi = &rwb->queue->backing_dev_info; + + trace_wbt_step(bdi, msg, rwb->scale_step, rwb->cur_win_nsec, rwb->wb_background, rwb->wb_normal, rwb->wb_max); } @@ -420,7 +423,8 @@ static void wb_timer_fn(unsigned long data) status = latency_exceeded(rwb); - trace_wbt_timer(rwb->bdi, status, rwb->scale_step, inflight); + trace_wbt_timer(&rwb->queue->backing_dev_info, status, rwb->scale_step, + inflight); /* * If we exceeded the latency target, step down. If we did not, @@ -700,7 +704,7 @@ int wbt_init(struct request_queue *q, struct wb_stat_ops *ops) rwb->wc = 1; rwb->queue_depth = RWB_DEF_DEPTH; rwb->last_comp = rwb->last_issue = jiffies; - rwb->bdi = &q->backing_dev_info; + rwb->queue = q; rwb->win_nsec = RWB_WINDOW_NSEC; rwb->stat_ops = ops; rwb->ops_data = q; diff --git a/block/blk-wbt.h b/block/blk-wbt.h index e57700337c26..09c61a3f8295 100644 --- a/block/blk-wbt.h +++ b/block/blk-wbt.h @@ -87,7 +87,7 @@ struct rq_wb { unsigned long last_issue; /* last non-throttled issue */ unsigned long last_comp; /* last non-throttled comp */ unsigned long min_lat_nsec; - struct backing_dev_info *bdi; + struct request_queue *queue; struct rq_wait rq_wait[WBT_NUM_RWQ]; struct wb_stat_ops *stat_ops; @@ -104,8 +104,6 @@ static inline unsigned int wbt_inflight(struct rq_wb *rwb) return ret; } -struct backing_dev_info; - #ifdef CONFIG_BLK_WBT void __wbt_done(struct rq_wb *, enum wbt_flags);