Commit 4245e52d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

md: don't detour through bd_contains for the gendisk

bd_disk is set on all block devices, including those for partitions.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarSong Liu <song@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 61a27e1f
...@@ -8444,7 +8444,7 @@ static int is_mddev_idle(struct mddev *mddev, int init) ...@@ -8444,7 +8444,7 @@ static int is_mddev_idle(struct mddev *mddev, int init)
idle = 1; idle = 1;
rcu_read_lock(); rcu_read_lock();
rdev_for_each_rcu(rdev, mddev) { rdev_for_each_rcu(rdev, mddev) {
struct gendisk *disk = rdev->bdev->bd_contains->bd_disk; struct gendisk *disk = rdev->bdev->bd_disk;
curr_events = (int)part_stat_read_accum(&disk->part0, sectors) - curr_events = (int)part_stat_read_accum(&disk->part0, sectors) -
atomic_read(&disk->sync_io); atomic_read(&disk->sync_io);
/* sync IO will cause sync_io to increase before the disk_stats /* sync IO will cause sync_io to increase before the disk_stats
......
...@@ -551,7 +551,7 @@ extern void mddev_unlock(struct mddev *mddev); ...@@ -551,7 +551,7 @@ extern void mddev_unlock(struct mddev *mddev);
static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors) static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
{ {
atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io); atomic_add(nr_sectors, &bdev->bd_disk->sync_io);
} }
static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors) static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors)
......
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