Skip to content

Commit 0806e60

Browse files
liu-song-6axboe
authored andcommitted
bcache: use part_[begin|end]_io_acct instead of disk_[begin|end]_io_acct
This enables proper statistics in /proc/diskstats for bcache partitions. Signed-off-by: Song Liu <songliubraving@fb.com> Reviewed-by: Coly Li <colyli@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 00fe60e commit 0806e60

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎drivers/md/bcache/request.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ struct search {
475475
unsigned int read_dirty_data:1;
476476
unsigned int cache_missed:1;
477477

478+
struct hd_struct *part;
478479
unsigned long start_time;
479480

480481
struct btree_op op;
@@ -669,7 +670,7 @@ static void bio_complete(struct search *s)
669670
{
670671
if (s->orig_bio) {
671672
/* Count on bcache device */
672-
disk_end_io_acct(s->d->disk, bio_op(s->orig_bio), s->start_time);
673+
part_end_io_acct(s->part, s->orig_bio, s->start_time);
673674

674675
trace_bcache_request_end(s->d, s->orig_bio);
675676
s->orig_bio->bi_status = s->iop.status;
@@ -731,7 +732,7 @@ static inline struct search *search_alloc(struct bio *bio,
731732
s->write = op_is_write(bio_op(bio));
732733
s->read_dirty_data = 0;
733734
/* Count on the bcache device */
734-
s->start_time = disk_start_io_acct(d->disk, bio_sectors(bio), bio_op(bio));
735+
s->start_time = part_start_io_acct(d->disk, &s->part, bio);
735736
s->iop.c = d->c;
736737
s->iop.bio = NULL;
737738
s->iop.inode = d->id;
@@ -1072,6 +1073,7 @@ struct detached_dev_io_private {
10721073
unsigned long start_time;
10731074
bio_end_io_t *bi_end_io;
10741075
void *bi_private;
1076+
struct hd_struct *part;
10751077
};
10761078

10771079
static void detached_dev_end_io(struct bio *bio)
@@ -1083,7 +1085,7 @@ static void detached_dev_end_io(struct bio *bio)
10831085
bio->bi_private = ddip->bi_private;
10841086

10851087
/* Count on the bcache device */
1086-
disk_end_io_acct(ddip->d->disk, bio_op(bio), ddip->start_time);
1088+
part_end_io_acct(ddip->part, bio, ddip->start_time);
10871089

10881090
if (bio->bi_status) {
10891091
struct cached_dev *dc = container_of(ddip->d,
@@ -1109,7 +1111,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio)
11091111
ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
11101112
ddip->d = d;
11111113
/* Count on the bcache device */
1112-
ddip->start_time = disk_start_io_acct(d->disk, bio_sectors(bio), bio_op(bio));
1114+
ddip->start_time = part_start_io_acct(d->disk, &ddip->part, bio);
11131115
ddip->bi_end_io = bio->bi_end_io;
11141116
ddip->bi_private = bio->bi_private;
11151117
bio->bi_end_io = detached_dev_end_io;

0 commit comments

Comments
 (0)