Commit a2f32ee
bcache: fix bio_{start,end}_io_acct with proper device
Commit 85750ae ("bcache: use bio_{start,end}_io_acct") moves the
io account code to the location after bio_set_dev(bio, dc->bdev) in
cached_dev_make_request(). Then the account is performed incorrectly on
backing device, indeed the I/O should be counted to bcache device like
/dev/bcache0.
With the mistaken I/O account, iostat does not display I/O counts for
bcache device and all the numbers go to backing device. In writeback
mode, the hard drive may have 340K+ IOPS which is impossible and wrong
for spinning disk.
This patch introduces bch_bio_start_io_acct() and bch_bio_end_io_acct(),
which switches bio->bi_disk to bcache device before calling
bio_start_io_acct() or bio_end_io_acct(). Now the I/Os are counted to
bcache device, and bcache device, cache device and backing device have
their correct I/O count information back.
Fixes: 85750ae ("bcache: use bio_{start,end}_io_acct")
Signed-off-by: Coly Li <colyli@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 4e4d4e0 commit a2f32ee
1 file changed
Lines changed: 27 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
617 | 617 | | |
618 | 618 | | |
619 | 619 | | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
620 | 642 | | |
621 | 643 | | |
622 | 644 | | |
| |||
668 | 690 | | |
669 | 691 | | |
670 | 692 | | |
671 | | - | |
| 693 | + | |
672 | 694 | | |
673 | 695 | | |
674 | 696 | | |
| |||
728 | 750 | | |
729 | 751 | | |
730 | 752 | | |
731 | | - | |
| 753 | + | |
732 | 754 | | |
733 | 755 | | |
734 | 756 | | |
| |||
1080 | 1102 | | |
1081 | 1103 | | |
1082 | 1104 | | |
1083 | | - | |
| 1105 | + | |
1084 | 1106 | | |
1085 | 1107 | | |
1086 | 1108 | | |
| |||
1105 | 1127 | | |
1106 | 1128 | | |
1107 | 1129 | | |
1108 | | - | |
| 1130 | + | |
| 1131 | + | |
1109 | 1132 | | |
1110 | 1133 | | |
1111 | 1134 | | |
| |||
0 commit comments