diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index deeac4b4417..0a3a4bdcd4a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1464,10 +1464,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
1464 | if ((err = kobject_add(&rdev->kobj, &mddev->kobj, "dev-%s", b))) | 1464 | if ((err = kobject_add(&rdev->kobj, &mddev->kobj, "dev-%s", b))) |
1465 | goto fail; | 1465 | goto fail; |
1466 | 1466 | ||
1467 | if (rdev->bdev->bd_part) | 1467 | ko = &part_to_dev(rdev->bdev->bd_part)->kobj; |
1468 | ko = &rdev->bdev->bd_part->dev.kobj; | ||
1469 | else | ||
1470 | ko = &rdev->bdev->bd_disk->dev.kobj; | ||
1471 | if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) { | 1468 | if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) { |
1472 | kobject_del(&rdev->kobj); | 1469 | kobject_del(&rdev->kobj); |
1473 | goto fail; | 1470 | goto fail; |
@@ -3470,8 +3467,8 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) | |||
3470 | disk->queue = mddev->queue; | 3467 | disk->queue = mddev->queue; |
3471 | add_disk(disk); | 3468 | add_disk(disk); |
3472 | mddev->gendisk = disk; | 3469 | mddev->gendisk = disk; |
3473 | error = kobject_init_and_add(&mddev->kobj, &md_ktype, &disk->dev.kobj, | 3470 | error = kobject_init_and_add(&mddev->kobj, &md_ktype, |
3474 | "%s", "md"); | 3471 | &disk_to_dev(disk)->kobj, "%s", "md"); |
3475 | mutex_unlock(&disks_mutex); | 3472 | mutex_unlock(&disks_mutex); |
3476 | if (error) | 3473 | if (error) |
3477 | printk(KERN_WARNING "md: cannot register %s/md - name in use\n", | 3474 | printk(KERN_WARNING "md: cannot register %s/md - name in use\n", |
@@ -3761,7 +3758,7 @@ static int do_md_run(mddev_t * mddev) | |||
3761 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | 3758 | sysfs_notify(&mddev->kobj, NULL, "array_state"); |
3762 | sysfs_notify(&mddev->kobj, NULL, "sync_action"); | 3759 | sysfs_notify(&mddev->kobj, NULL, "sync_action"); |
3763 | sysfs_notify(&mddev->kobj, NULL, "degraded"); | 3760 | sysfs_notify(&mddev->kobj, NULL, "degraded"); |
3764 | kobject_uevent(&mddev->gendisk->dev.kobj, KOBJ_CHANGE); | 3761 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); |
3765 | return 0; | 3762 | return 0; |
3766 | } | 3763 | } |
3767 | 3764 | ||
@@ -5549,8 +5546,8 @@ static int is_mddev_idle(mddev_t *mddev) | |||
5549 | rcu_read_lock(); | 5546 | rcu_read_lock(); |
5550 | rdev_for_each_rcu(rdev, mddev) { | 5547 | rdev_for_each_rcu(rdev, mddev) { |
5551 | struct gendisk *disk = rdev->bdev->bd_contains->bd_disk; | 5548 | struct gendisk *disk = rdev->bdev->bd_contains->bd_disk; |
5552 | curr_events = disk_stat_read(disk, sectors[0]) + | 5549 | curr_events = part_stat_read(&disk->part0, sectors[0]) + |
5553 | disk_stat_read(disk, sectors[1]) - | 5550 | part_stat_read(&disk->part0, sectors[1]) - |
5554 | atomic_read(&disk->sync_io); | 5551 | atomic_read(&disk->sync_io); |
5555 | /* sync IO will cause sync_io to increase before the disk_stats | 5552 | /* sync IO will cause sync_io to increase before the disk_stats |
5556 | * as sync_io is counted when a request starts, and | 5553 | * as sync_io is counted when a request starts, and |