Commit e439bedf authored by Dennis Zhou's avatar Dennis Zhou Committed by Jens Axboe

blkcg: consolidate bio_issue_init() to be a part of core

bio_issue_init among other things initializes the timestamp for an IO.
Rather than have this logic handled by policies, this consolidates it to
be on the init paths (normal, clone, bounce clone).
Signed-off-by: default avatarDennis Zhou <dennis@kernel.org>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Reviewed-by: default avatarLiu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5cdf2e3f
...@@ -611,6 +611,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src) ...@@ -611,6 +611,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
bio->bi_io_vec = bio_src->bi_io_vec; bio->bi_io_vec = bio_src->bi_io_vec;
bio_clone_blkcg_association(bio, bio_src); bio_clone_blkcg_association(bio, bio_src);
blkcg_bio_issue_init(bio);
} }
EXPORT_SYMBOL(__bio_clone_fast); EXPORT_SYMBOL(__bio_clone_fast);
......
...@@ -478,8 +478,6 @@ static void blkcg_iolatency_throttle(struct rq_qos *rqos, struct bio *bio) ...@@ -478,8 +478,6 @@ static void blkcg_iolatency_throttle(struct rq_qos *rqos, struct bio *bio)
if (!blk_iolatency_enabled(blkiolat)) if (!blk_iolatency_enabled(blkiolat))
return; return;
bio_issue_init(&bio->bi_issue, bio_sectors(bio));
while (blkg && blkg->parent) { while (blkg && blkg->parent) {
struct iolatency_grp *iolat = blkg_to_lat(blkg); struct iolatency_grp *iolat = blkg_to_lat(blkg);
if (!iolat) { if (!iolat) {
......
...@@ -2115,13 +2115,6 @@ static inline void throtl_update_latency_buckets(struct throtl_data *td) ...@@ -2115,13 +2115,6 @@ static inline void throtl_update_latency_buckets(struct throtl_data *td)
} }
#endif #endif
static void blk_throtl_assoc_bio(struct bio *bio)
{
#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
bio_issue_init(&bio->bi_issue, bio_sectors(bio));
#endif
}
bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg,
struct bio *bio) struct bio *bio)
{ {
...@@ -2142,7 +2135,6 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, ...@@ -2142,7 +2135,6 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg,
throtl_update_latency_buckets(td); throtl_update_latency_buckets(td);
blk_throtl_assoc_bio(bio);
blk_throtl_update_idletime(tg); blk_throtl_update_idletime(tg);
sq = &tg->service_queue; sq = &tg->service_queue;
......
...@@ -278,6 +278,7 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask, ...@@ -278,6 +278,7 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask,
} }
bio_clone_blkcg_association(bio, bio_src); bio_clone_blkcg_association(bio, bio_src);
blkcg_bio_issue_init(bio);
return bio; return bio;
} }
......
...@@ -800,6 +800,12 @@ static inline bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg ...@@ -800,6 +800,12 @@ static inline bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg
struct bio *bio) { return false; } struct bio *bio) { return false; }
#endif #endif
static inline void blkcg_bio_issue_init(struct bio *bio)
{
bio_issue_init(&bio->bi_issue, bio_sectors(bio));
}
static inline bool blkcg_bio_issue_check(struct request_queue *q, static inline bool blkcg_bio_issue_check(struct request_queue *q,
struct bio *bio) struct bio *bio)
{ {
...@@ -831,6 +837,8 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q, ...@@ -831,6 +837,8 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1); blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1);
} }
blkcg_bio_issue_init(bio);
return !throtl; return !throtl;
} }
...@@ -936,6 +944,7 @@ static inline char *blkg_path(struct blkcg_gq *blkg) { return NULL; } ...@@ -936,6 +944,7 @@ static inline char *blkg_path(struct blkcg_gq *blkg) { return NULL; }
static inline void blkg_get(struct blkcg_gq *blkg) { } static inline void blkg_get(struct blkcg_gq *blkg) { }
static inline void blkg_put(struct blkcg_gq *blkg) { } static inline void blkg_put(struct blkcg_gq *blkg) { }
static inline void blkcg_bio_issue_init(struct bio *bio) { }
static inline bool blkcg_bio_issue_check(struct request_queue *q, static inline bool blkcg_bio_issue_check(struct request_queue *q,
struct bio *bio) { return true; } struct bio *bio) { return true; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment