diff options
author | Jens Axboe <axboe@kernel.dk> | 2021-06-15 15:42:56 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-06-15 15:42:56 -0600 |
commit | e0d245e2230998e66dfda10fb8c413f29196eb1c (patch) | |
tree | 555c54326b400a3924d1dc2d45540baaddbea8c9 /drivers/md/raid1.c | |
parent | 491e5b170ef8bf951d9337b1a7ee9f9c1465ffe8 (diff) | |
parent | 97ae27252f4962d0fcc38ee1d9f913d817a2024e (diff) | |
download | linux-e0d245e2230998e66dfda10fb8c413f29196eb1c.tar.gz linux-e0d245e2230998e66dfda10fb8c413f29196eb1c.tar.bz2 linux-e0d245e2230998e66dfda10fb8c413f29196eb1c.zip |
Merge branch 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-5.14/drivers
Pull MD changes from Song:
"1) iostats rewrite by Guoqing Jiang;
2) raid5 lock contention optimization by Gal Ofri."
* 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md:
md/raid5: avoid device_lock in read_one_chunk()
md: add comments in md_integrity_register
md: check level before create and exit io_acct_set
md: Constify attribute_group structs
md: mark some personalities as deprecated
md/raid10: enable io accounting
md/raid1: enable io accounting
md/raid1: rename print_msg with r1bio_existed
md/raid5: avoid redundant bio clone in raid5_read_one_chunk
md/raid5: move checking badblock before clone bio in raid5_read_one_chunk
md: add io accounting for raid0 and raid5
md: revert io stats accounting
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index ced076ba560e..51f2547c2007 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -300,6 +300,8 @@ static void call_bio_endio(struct r1bio *r1_bio) if (!test_bit(R1BIO_Uptodate, &r1_bio->state)) bio->bi_status = BLK_STS_IOERR; + if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue)) + bio_end_io_acct(bio, r1_bio->start_time); bio_endio(bio); } @@ -1210,7 +1212,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, const unsigned long do_sync = (bio->bi_opf & REQ_SYNC); int max_sectors; int rdisk; - bool print_msg = !!r1_bio; + bool r1bio_existed = !!r1_bio; char b[BDEVNAME_SIZE]; /* @@ -1220,7 +1222,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, */ gfp_t gfp = r1_bio ? (GFP_NOIO | __GFP_HIGH) : GFP_NOIO; - if (print_msg) { + if (r1bio_existed) { /* Need to get the block device name carefully */ struct md_rdev *rdev; rcu_read_lock(); @@ -1252,7 +1254,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, if (rdisk < 0) { /* couldn't find anywhere to read from */ - if (print_msg) { + if (r1bio_existed) { pr_crit_ratelimited("md/raid1:%s: %s: unrecoverable I/O read error for block %llu\n", mdname(mddev), b, @@ -1263,7 +1265,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, } mirror = conf->mirrors + rdisk; - if (print_msg) + if (r1bio_existed) pr_info_ratelimited("md/raid1:%s: redirecting sector %llu to other mirror: %s\n", mdname(mddev), (unsigned long long)r1_bio->sector, @@ -1292,6 +1294,9 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, r1_bio->read_disk = rdisk; + if (!r1bio_existed && blk_queue_io_stat(bio->bi_bdev->bd_disk->queue)) + r1_bio->start_time = bio_start_io_acct(bio); + read_bio = bio_clone_fast(bio, gfp, &mddev->bio_set); r1_bio->bios[rdisk] = read_bio; @@ -1461,6 +1466,8 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, r1_bio->sectors = max_sectors; } + if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue)) + r1_bio->start_time = bio_start_io_acct(bio); atomic_set(&r1_bio->remaining, 1); atomic_set(&r1_bio->behind_remaining, 0); |