Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp918574imm; Tue, 5 Jun 2018 06:33:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKUlcy0DoOBfVIEfzCs/D5XrYL0+NDnWfIsa+0gyREQFq+US0GTXO+sVbGa5b9R3uJ4zxLw X-Received: by 2002:a63:9741:: with SMTP id d1-v6mr8884704pgo.403.1528205615706; Tue, 05 Jun 2018 06:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528205615; cv=none; d=google.com; s=arc-20160816; b=HL+eceH/E0j1aHFa0bxCpSO5khsuW6KRYHMGPJ7F75CrpZmStfmPaSOd/At8nilZww 9ElCRgzD9KFTZJoVjOhbAPxyDO25yLoe6mCz1CWw+FoLjW0cdjE0ZpqzDdZubWObBq+j ef6PErpX9KYwD0Zf8fIscDs5ztmh5yltd/yeX0DmgBKIEValvZIOMYRm5GtesigPrH0I SB98m5L5NFaKkbRRenq/ytEOHS+aPv8qnxqJjw1a4ouIzNOqV+0vlF97xeIBXzNUJfB+ irC8qcCN/udJzfkMc4cGsfihNdHuijZ6NiLQTRqOHlUEAjoMk8xrRzQPyz0ZD+7lvuLC Lczw== 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=oqEXHFPy/UD/4NNoUiVbo/dXSAkuFuYpl2PiuLJXLwU=; b=wwaCkN7a0BLbptld0S4DrFcrAVdzTAqDYdqMugdfMaASQ/wbyHROOOJNLoAe0G8t22 YAhsTRANTRkYOP7FMVv/mtg/4ZlHL1WiePQsYFHdnmGfHzrBvkJxUrREiRM7PX1Ews1M kNJ5s/xRduy54XOzC8RDAn77xmWEa/qx0D9hQHkExpqwlgfAKuCNAbuiEEJDLpP1ypnp f4tYbnXfETV8TaJbwh+MQpr6i3GB0MGshbzz04kGjETsfg/8TzwCd4laKhHQ5xrAz2JV 9L73Iczy6bVKA0LgBT0nu/0/+9B51a/p4dBdy99RHrUCr/XHF7tKVc2SzYRsMVprqYUb 9c/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=i25HFeap; 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 k2-v6si4888732pgr.206.2018.06.05.06.33.20; Tue, 05 Jun 2018 06:33:35 -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=i25HFeap; 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 S1752138AbeFENbA (ORCPT + 99 others); Tue, 5 Jun 2018 09:31:00 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:42540 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752070AbeFENaI (ORCPT ); Tue, 5 Jun 2018 09:30:08 -0400 Received: by mail-qt0-f193.google.com with SMTP id y31-v6so2339551qty.9 for ; Tue, 05 Jun 2018 06:30:07 -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=oqEXHFPy/UD/4NNoUiVbo/dXSAkuFuYpl2PiuLJXLwU=; b=i25HFeapzOFJsrSPO5Kb/tgFUJh+41NszzsrHf/NoTDAxWsSusl62GgYACMzvF830Z eX/X1V8qU726aa9TDLpvMiFl9TOgFH/mmJqjUSnOAXL7OkmHlkOEinSCS8ZRJm+Awx5r LXy2ISH06Ei0mh8MndzXuyLKV86C5tAPajCwis3FLqlcomrs8af4rlPTy9B9SU2zoQ3l p4c9yWTZRSgMAbgJz4icHdoxdgSWjLGKALdNfnM2fiGGjPFGRLpgUgVRrQygOH9JHt94 Om99yR4iJ7V+bMrY//tEkWxyRxiSx7s7E/QTrni1KWY0C4yrCb33ZUBMBNeza2XXou7r kVsQ== 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=oqEXHFPy/UD/4NNoUiVbo/dXSAkuFuYpl2PiuLJXLwU=; b=GdAt16pf17B1B9SCArnElk4Vmwz7xnHukB9B9quKWHcfI0OrIXUSk7i9euWaIG/3HD q9rJUFfHIjldU8MPntlceeoxIFlv4mPJg7GuCI5F6A8ZlSvBHIELD4kkrUj96tOjhQ7T 21GFhsbck7FikQ7AwmiIp+Hc3OPzR9DB4fImJtdDvuMl8/8Ck8lfW28EiFPjQl+eYa6J EBY6hkj3F7qJwSTC0zxHUkZRVF5csk+vjhb5YM7op1bhHm03e1MoN+Qzz1u/NsaQWT2Y dZgTaFpv1c1sdU2YHm8vT4rBW404seGdbqsP0V26YfVNkBcuGfUTnIOYmmwnECraW3vX 4fnA== X-Gm-Message-State: APt69E0YtPCoJbXLkGfF5Fw+A5naYsANmXe5Gz8LmSoviUZFjnHcUH55 A4dEmxaAwACBJtxCM1LmpQANPQ== X-Received: by 2002:a0c:e90f:: with SMTP id a15-v6mr23179772qvo.165.1528205407363; Tue, 05 Jun 2018 06:30:07 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id j28-v6sm17478110qtk.56.2018.06.05.06.30.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 06:30:06 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, kernel-team@fb.com, linux-block@vger.kernel.org, akpm@linux-foundation.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, tj@kernel.org, linux-fsdevel@vger.kernel.org Cc: Josef Bacik Subject: [PATCH 11/13] rq-qos: introduce dio_bio callback Date: Tue, 5 Jun 2018 09:29:46 -0400 Message-Id: <20180605132948.1664-12-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180605132948.1664-1-josef@toxicpanda.com> References: <20180605132948.1664-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 501253676dd8..3874e6ad09f0 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 *); }; @@ -86,6 +87,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