Skip to content

Commit

Permalink
rq-qos: introduce dio_bio callback
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Josef Bacik authored and axboe committed Jul 9, 2018
1 parent c1c8038 commit 67b42d0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions block/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1808,6 +1809,9 @@ void bio_endio(struct bio *bio)
if (!bio_integrity_endio(bio))
return;

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
Expand Down
10 changes: 10 additions & 0 deletions block/blk-rq-qos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 2 additions & 0 deletions block/blk-rq-qos.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
};
Expand Down Expand Up @@ -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 *);
Expand Down

0 comments on commit 67b42d0

Please sign in to comment.