Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6789027imm; Wed, 27 Jun 2018 13:26:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJPlp0RsEijZmFcQF9CkVYviskml4AMRfpxwCn7CDC+cYV0Da3McKWRfVYCvXPfityQrCX5 X-Received: by 2002:a63:6d8b:: with SMTP id i133-v6mr6562360pgc.215.1530131219883; Wed, 27 Jun 2018 13:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530131219; cv=none; d=google.com; s=arc-20160816; b=yIOjJtNq+R3M+0K732UwAEGsg05nhjgUVWtOP4fDOzSTw2/eWTw8Af2oGHECeSQAGX GfAXUV1Qf8AYlFig/LIIhvP5ZNi58sd2mVPhaBzh6XXtlREYrbAEWkYGa8IaJXwsMzN4 EP5PSGy1l+Wt+ibTtHjcRnXW+HzIsKSo7AAL762ahiwOMLCb6u+wHe0B2zgNR3eQErC7 nrhaILy08meeUFGbJFJtv4C3onCir+AUIxS1eBsPygqyZMAP9QVxpNkaYXrrKx4h0TmD 3Kbbt8MRsMgw9sZly3echtbnFRD1u9Q67Y1goyywnkRyRCTu0UQlLfr63nCcYUupW7X0 SwPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=4sjBaATrdVpUH2y/if0LRnwspa7VVD1JJv3hKyhv66U=; b=Yos67dKpr9SeEGDiLtWy7B9lSI7YPr3dabMnClU8iFYv4gLaeNydQwyflTKY2oon3j +sPGUKstBLlUwTDVGxlqNKR/xMFJoaEDVwqJCHYkX+Lbd/hM+CHpSKic/qAyckvH8AwX jRfnJaRf/3EqUiRQ5CmUlkra0qjbz+yWBTJagLrFeIu7bryIiNxK4ko4XR8Z0akaqE/P pCx0b9JSE4poF4BaqD7tGpcyjBtoOz385gsVgeELL7unVUEwYS1GvTJUJLGt7p9mVnt+ 3XqDTrkKRO9hThHqwMcjDHI86vd+xIbs03k41aV+CbKvtul8IfPX6B2CUldhGYJCzSeT AO3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=ZXgcI8WX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 187-v6si4105796pgi.254.2018.06.27.13.26.44; Wed, 27 Jun 2018 13:26:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=ZXgcI8WX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966335AbeF0TLd (ORCPT + 99 others); Wed, 27 Jun 2018 15:11:33 -0400 Received: from mail-qt0-f175.google.com ([209.85.216.175]:39685 "EHLO mail-qt0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966222AbeF0TKA (ORCPT ); Wed, 27 Jun 2018 15:10:00 -0400 Received: by mail-qt0-f175.google.com with SMTP id b20-v6so2006742qtp.6 for ; Wed, 27 Jun 2018 12:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4sjBaATrdVpUH2y/if0LRnwspa7VVD1JJv3hKyhv66U=; b=ZXgcI8WXqgvT4DifAydQZhVj9xoTQivBSf3eChTtBlkKc1y9q6AlaEQ1JGogZGMo33 TfNzdx4hZt96vtZECY8XnCmYGw6gCMZrTo1lxHLb/eCsnp0oOHpv4WGpH0Hm1tTfWqIk Ngl7nEIqtB64MCT1mklvELvqiP3meSfuMzi2pSF4K8npfC3M3OwmT6pKkqwe7FgiPMeL /HsW6BE7pkIdPzUFc+cs1ytvX54o22Govl6XYCqZQ0WkXhUxiJn3RNacDnsIGoOPyjGs ftJUHitiQD836a0fVOL9AVLFcpWVqIjalErVrgdHrnsM8ViU7nvLB4y3BD5QjlYDl8aa /Fvw== 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; bh=4sjBaATrdVpUH2y/if0LRnwspa7VVD1JJv3hKyhv66U=; b=cyVIBdv72ampzLAIdqeyFnAZRHwXuJCwmJ/kjlS2d1AoBrYjp+PEBIAMMb/1zpjq8B UFe0WoFxsJKYXg7Q0RH44LbDauFhDUHzOlOX141gGyGJl6G/mM/Z+HHZ+ICjzXlFPx87 G6a8C+xQDW0DbbCS6/1TXWJS/dcv7YQlsh8qXm0UOHvGvKSieN54U4SYmG0QF/NyFatA VSdjqAcm0hYL/dCMR5tMvETQk+bgVrzKd1JYHRAIuvh5nBsywHA7TbtJ0PV6Hg3Q7u2B L6AEqWcGbQi0nEtfBQie16MFV82eAPQEK9zOrgj4MpNetdI2R3djFfMm/fIIU8IC9C0D R69Q== X-Gm-Message-State: APt69E0dK1aJwJdcfUhAq2vNYEh90OpO5jdlgJqFjBuRSdZ/JfsHVFLX KHeSgJeyN19OM4kiAuXvIKr9+g== X-Received: by 2002:ac8:13cd:: with SMTP id i13-v6mr6621112qtj.374.1530126599750; Wed, 27 Jun 2018 12:09:59 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id a11-v6sm1184835qta.47.2018.06.27.12.09.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Jun 2018 12:09:59 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com, akpm@linux-foundation.org, hannes@cmpxchg.org, tj@kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Josef Bacik Subject: [PATCH 11/14] rq-qos: introduce dio_bio callback Date: Wed, 27 Jun 2018 15:09:37 -0400 Message-Id: <20180627190940.4696-12-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180627190940.4696-1-josef@toxicpanda.com> References: <20180627190940.4696-1-josef@toxicpanda.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik wbt cares only about request completion time, but controllers may need information that is on the bio itself, so add a done_bio callback for rq-qos so things like blk-iolatency can use it to have the bio when it completes. Signed-off-by: Josef Bacik --- block/bio.c | 4 ++++ block/blk-rq-qos.c | 10 ++++++++++ block/blk-rq-qos.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/block/bio.c b/block/bio.c index c77fe1b4caa8..99809b73a400 100644 --- a/block/bio.c +++ b/block/bio.c @@ -32,6 +32,7 @@ #include #include "blk.h" +#include "blk-rq-qos.h" /* * Test patch to inline a certain number of bi_io_vec's inside the bio @@ -1781,6 +1782,9 @@ void bio_endio(struct bio *bio) if (WARN_ONCE(bio->bi_next, "driver left bi_next not NULL")) bio->bi_next = NULL; + if (bio->bi_disk) + rq_qos_done_bio(bio->bi_disk->queue, bio); + /* * Need to have a real endio function for chained bios, otherwise * various corner cases will break (like stacking block devices that diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c index b7b02e04f64f..5134b24482f6 100644 --- a/block/blk-rq-qos.c +++ b/block/blk-rq-qos.c @@ -88,6 +88,16 @@ void rq_qos_track(struct request_queue *q, struct request *rq, struct bio *bio) } } +void rq_qos_done_bio(struct request_queue *q, struct bio *bio) +{ + struct rq_qos *rqos; + + for(rqos = q->rq_qos; rqos; rqos = rqos->next) { + if (rqos->ops->done_bio) + rqos->ops->done_bio(rqos, bio); + } +} + /* * Return true, if we can't increase the depth further by scaling */ diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h index a6d13b8ce0dc..d5e2f68fe41e 100644 --- a/block/blk-rq-qos.h +++ b/block/blk-rq-qos.h @@ -30,6 +30,7 @@ struct rq_qos_ops { void (*issue)(struct rq_qos *, struct request *); void (*requeue)(struct rq_qos *, struct request *); void (*done)(struct rq_qos *, struct request *); + void (*done_bio)(struct rq_qos *, struct bio *); void (*cleanup)(struct rq_qos *, struct bio *); void (*exit)(struct rq_qos *); }; @@ -101,6 +102,7 @@ void rq_qos_cleanup(struct request_queue *, struct bio *); void rq_qos_done(struct request_queue *, struct request *); void rq_qos_issue(struct request_queue *, struct request *); void rq_qos_requeue(struct request_queue *, struct request *); +void rq_qos_done_bio(struct request_queue *q, struct bio *bio); void rq_qos_throttle(struct request_queue *, struct bio *, spinlock_t *); void rq_qos_track(struct request_queue *q, struct request *, struct bio *); void rq_qos_exit(struct request_queue *); -- 2.14.3