All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com,
	akpm@linux-foundation.org, hannes@cmpxchg.org,
	linux-kernel@vger.kernel.org, tj@kernel.org,
	linux-fsdevel@vger.kernel.org
Cc: Josef Bacik <jbacik@fb.com>
Subject: [PATCH 11/15] rq-qos: introduce dio_bio callback
Date: Mon, 25 Jun 2018 11:12:39 -0400	[thread overview]
Message-ID: <20180625151243.2132-12-josef@toxicpanda.com> (raw)
In-Reply-To: <20180625151243.2132-1-josef@toxicpanda.com>

From: Josef Bacik <jbacik@fb.com>

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 <jbacik@fb.com>
---
 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 <trace/events/block.h>
 #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

  parent reply	other threads:[~2018-06-25 15:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 15:12 [PATCH 0/15][V3] Introduce io.latency io controller for cgroups Josef Bacik
2018-06-25 15:12 ` [PATCH 01/15] block: add bi_blkg to the bio " Josef Bacik
2018-06-25 15:12 ` [PATCH 02/15] block: introduce bio_issue_as_root_blkg Josef Bacik
2018-06-25 15:12 ` [PATCH 03/15] blk-cgroup: allow controllers to output their own stats Josef Bacik
2018-06-25 15:12 ` [PATCH 04/15] blk: introduce REQ_SWAP Josef Bacik
2018-06-25 15:12 ` [PATCH 05/15] swap,blkcg: issue swap io with the appropriate context Josef Bacik
2018-06-25 15:12 ` [PATCH 06/15] blkcg: add generic throttling mechanism Josef Bacik
2018-06-25 15:12 ` [PATCH 07/15] memcontrol: schedule throttling if we are congested Josef Bacik
2018-06-25 15:12 ` [PATCH 08/15] blk-stat: export helpers for modifying blk_rq_stat Josef Bacik
2018-06-25 15:12 ` [PATCH 09/15] blk-rq-qos: refactor out common elements of blk-wbt Josef Bacik
2018-06-25 15:12 ` [PATCH 10/15] block: remove external dependency on wbt_flags Josef Bacik
2018-06-25 15:12 ` Josef Bacik [this message]
2018-06-25 15:12 ` [PATCH 12/15] block: introduce blk-iolatency io controller Josef Bacik
2018-06-27 19:06   ` Jens Axboe
2018-06-27 19:20     ` Josef Bacik
2018-06-27 19:24       ` Jens Axboe
2018-06-28 13:26         ` Josef Bacik
2018-06-28 15:35           ` Jens Axboe
2018-06-25 15:12 ` [PATCH 13/15] Documentation: add a doc for blk-iolatency Josef Bacik
2018-06-25 22:36   ` Randy Dunlap
2018-06-25 15:12 ` [PATCH 14/15] skip readahead if the cgroup is congested Josef Bacik
2018-06-25 15:12 ` [PATCH 15/15] block: use irq variant for blkcg->lock Josef Bacik
2018-06-27 19:06 ` [PATCH 12/15] block: introduce blk-iolatency io controller Jens Axboe
2018-06-27 23:53   ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180625151243.2132-12-josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=hannes@cmpxchg.org \
    --cc=jbacik@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.