Skip to content

Commit 67b42d0

Browse files
Josef Bacikaxboe
authored andcommitted
rq-qos: introduce dio_bio callback
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> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent c1c8038 commit 67b42d0

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

block/bio.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#include <trace/events/block.h>
3434
#include "blk.h"
35+
#include "blk-rq-qos.h"
3536

3637
/*
3738
* Test patch to inline a certain number of bi_io_vec's inside the bio
@@ -1808,6 +1809,9 @@ void bio_endio(struct bio *bio)
18081809
if (!bio_integrity_endio(bio))
18091810
return;
18101811

1812+
if (bio->bi_disk)
1813+
rq_qos_done_bio(bio->bi_disk->queue, bio);
1814+
18111815
/*
18121816
* Need to have a real endio function for chained bios, otherwise
18131817
* various corner cases will break (like stacking block devices that

block/blk-rq-qos.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ void rq_qos_track(struct request_queue *q, struct request *rq, struct bio *bio)
8888
}
8989
}
9090

91+
void rq_qos_done_bio(struct request_queue *q, struct bio *bio)
92+
{
93+
struct rq_qos *rqos;
94+
95+
for(rqos = q->rq_qos; rqos; rqos = rqos->next) {
96+
if (rqos->ops->done_bio)
97+
rqos->ops->done_bio(rqos, bio);
98+
}
99+
}
100+
91101
/*
92102
* Return true, if we can't increase the depth further by scaling
93103
*/

block/blk-rq-qos.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct rq_qos_ops {
3030
void (*issue)(struct rq_qos *, struct request *);
3131
void (*requeue)(struct rq_qos *, struct request *);
3232
void (*done)(struct rq_qos *, struct request *);
33+
void (*done_bio)(struct rq_qos *, struct bio *);
3334
void (*cleanup)(struct rq_qos *, struct bio *);
3435
void (*exit)(struct rq_qos *);
3536
};
@@ -101,6 +102,7 @@ void rq_qos_cleanup(struct request_queue *, struct bio *);
101102
void rq_qos_done(struct request_queue *, struct request *);
102103
void rq_qos_issue(struct request_queue *, struct request *);
103104
void rq_qos_requeue(struct request_queue *, struct request *);
105+
void rq_qos_done_bio(struct request_queue *q, struct bio *bio);
104106
void rq_qos_throttle(struct request_queue *, struct bio *, spinlock_t *);
105107
void rq_qos_track(struct request_queue *q, struct request *, struct bio *);
106108
void rq_qos_exit(struct request_queue *);

0 commit comments

Comments
 (0)