Commit 85750aeb authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

bcache: use bio_{start,end}_io_acct

Switch bcache to use the nicer bio accounting helpers, and call the
routines where we also sample the start time to give coherent accounting
results.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Acked-by: default avatarColy Li <colyli@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a8e45650
...@@ -668,9 +668,7 @@ static void backing_request_endio(struct bio *bio) ...@@ -668,9 +668,7 @@ static void backing_request_endio(struct bio *bio)
static void bio_complete(struct search *s) static void bio_complete(struct search *s)
{ {
if (s->orig_bio) { if (s->orig_bio) {
generic_end_io_acct(s->d->disk->queue, bio_op(s->orig_bio), bio_end_io_acct(s->orig_bio, s->start_time);
&s->d->disk->part0, s->start_time);
trace_bcache_request_end(s->d, s->orig_bio); trace_bcache_request_end(s->d, s->orig_bio);
s->orig_bio->bi_status = s->iop.status; s->orig_bio->bi_status = s->iop.status;
bio_endio(s->orig_bio); bio_endio(s->orig_bio);
...@@ -730,7 +728,7 @@ static inline struct search *search_alloc(struct bio *bio, ...@@ -730,7 +728,7 @@ static inline struct search *search_alloc(struct bio *bio,
s->recoverable = 1; s->recoverable = 1;
s->write = op_is_write(bio_op(bio)); s->write = op_is_write(bio_op(bio));
s->read_dirty_data = 0; s->read_dirty_data = 0;
s->start_time = jiffies; s->start_time = bio_start_io_acct(bio);
s->iop.c = d->c; s->iop.c = d->c;
s->iop.bio = NULL; s->iop.bio = NULL;
...@@ -1082,8 +1080,7 @@ static void detached_dev_end_io(struct bio *bio) ...@@ -1082,8 +1080,7 @@ static void detached_dev_end_io(struct bio *bio)
bio->bi_end_io = ddip->bi_end_io; bio->bi_end_io = ddip->bi_end_io;
bio->bi_private = ddip->bi_private; bio->bi_private = ddip->bi_private;
generic_end_io_acct(ddip->d->disk->queue, bio_op(bio), bio_end_io_acct(bio, ddip->start_time);
&ddip->d->disk->part0, ddip->start_time);
if (bio->bi_status) { if (bio->bi_status) {
struct cached_dev *dc = container_of(ddip->d, struct cached_dev *dc = container_of(ddip->d,
...@@ -1108,7 +1105,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio) ...@@ -1108,7 +1105,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio)
*/ */
ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
ddip->d = d; ddip->d = d;
ddip->start_time = jiffies; ddip->start_time = bio_start_io_acct(bio);
ddip->bi_end_io = bio->bi_end_io; ddip->bi_end_io = bio->bi_end_io;
ddip->bi_private = bio->bi_private; ddip->bi_private = bio->bi_private;
bio->bi_end_io = detached_dev_end_io; bio->bi_end_io = detached_dev_end_io;
...@@ -1190,11 +1187,6 @@ blk_qc_t cached_dev_make_request(struct request_queue *q, struct bio *bio) ...@@ -1190,11 +1187,6 @@ blk_qc_t cached_dev_make_request(struct request_queue *q, struct bio *bio)
} }
} }
generic_start_io_acct(q,
bio_op(bio),
bio_sectors(bio),
&d->disk->part0);
bio_set_dev(bio, dc->bdev); bio_set_dev(bio, dc->bdev);
bio->bi_iter.bi_sector += dc->sb.data_offset; bio->bi_iter.bi_sector += dc->sb.data_offset;
...@@ -1311,8 +1303,6 @@ blk_qc_t flash_dev_make_request(struct request_queue *q, struct bio *bio) ...@@ -1311,8 +1303,6 @@ blk_qc_t flash_dev_make_request(struct request_queue *q, struct bio *bio)
return BLK_QC_T_NONE; return BLK_QC_T_NONE;
} }
generic_start_io_acct(q, bio_op(bio), bio_sectors(bio), &d->disk->part0);
s = search_alloc(bio, d); s = search_alloc(bio, d);
cl = &s->cl; cl = &s->cl;
bio = &s->bio.bio; bio = &s->bio.bio;
......
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