aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/md.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 199016932de5..8238c1c0ec09 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -762,7 +762,7 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
762 struct list_head *tmp; 762 struct list_head *tmp;
763 mdk_rdev_t *rdev2; 763 mdk_rdev_t *rdev2;
764 int next_spare = mddev->raid_disks; 764 int next_spare = mddev->raid_disks;
765 char nm[20]; 765
766 766
767 /* make rdev->sb match mddev data.. 767 /* make rdev->sb match mddev data..
768 * 768 *
@@ -776,7 +776,6 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
776 */ 776 */
777 int i; 777 int i;
778 int active=0, working=0,failed=0,spare=0,nr_disks=0; 778 int active=0, working=0,failed=0,spare=0,nr_disks=0;
779 unsigned int fixdesc=0;
780 779
781 rdev->sb_size = MD_SB_BYTES; 780 rdev->sb_size = MD_SB_BYTES;
782 781
@@ -830,16 +829,7 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
830 desc_nr = rdev2->raid_disk; 829 desc_nr = rdev2->raid_disk;
831 else 830 else
832 desc_nr = next_spare++; 831 desc_nr = next_spare++;
833 if (desc_nr != rdev2->desc_nr) { 832 rdev2->desc_nr = desc_nr;
834 fixdesc |= (1 << desc_nr);
835 rdev2->desc_nr = desc_nr;
836 if (rdev2->raid_disk >= 0) {
837 sprintf(nm, "rd%d", rdev2->raid_disk);
838 sysfs_remove_link(&mddev->kobj, nm);
839 }
840 sysfs_remove_link(&rdev2->kobj, "block");
841 kobject_del(&rdev2->kobj);
842 }
843 d = &sb->disks[rdev2->desc_nr]; 833 d = &sb->disks[rdev2->desc_nr];
844 nr_disks++; 834 nr_disks++;
845 d->number = rdev2->desc_nr; 835 d->number = rdev2->desc_nr;
@@ -866,25 +856,6 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
866 if (test_bit(WriteMostly, &rdev2->flags)) 856 if (test_bit(WriteMostly, &rdev2->flags))
867 d->state |= (1<<MD_DISK_WRITEMOSTLY); 857 d->state |= (1<<MD_DISK_WRITEMOSTLY);
868 } 858 }
869 if (fixdesc)
870 ITERATE_RDEV(mddev,rdev2,tmp)
871 if (fixdesc & (1<<rdev2->desc_nr)) {
872 snprintf(rdev2->kobj.name, KOBJ_NAME_LEN, "dev%d",
873 rdev2->desc_nr);
874 /* kobject_add gets a ref on the parent, so
875 * we have to drop the one we already have
876 */
877 kobject_add(&rdev2->kobj);
878 kobject_put(rdev->kobj.parent);
879 sysfs_create_link(&rdev2->kobj,
880 &rdev2->bdev->bd_disk->kobj,
881 "block");
882 if (rdev2->raid_disk >= 0) {
883 sprintf(nm, "rd%d", rdev2->raid_disk);
884 sysfs_create_link(&mddev->kobj,
885 &rdev2->kobj, nm);
886 }
887 }
888 /* now set the "removed" and "faulty" bits on any missing devices */ 859 /* now set the "removed" and "faulty" bits on any missing devices */
889 for (i=0 ; i < mddev->raid_disks ; i++) { 860 for (i=0 ; i < mddev->raid_disks ; i++) {
890 mdp_disk_t *d = &sb->disks[i]; 861 mdp_disk_t *d = &sb->disks[i];
@@ -1237,13 +1208,14 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1237 if (find_rdev_nr(mddev, rdev->desc_nr)) 1208 if (find_rdev_nr(mddev, rdev->desc_nr))
1238 return -EBUSY; 1209 return -EBUSY;
1239 } 1210 }
1211 bdevname(rdev->bdev,b);
1212 if (kobject_set_name(&rdev->kobj, "dev-%s", b) < 0)
1213 return -ENOMEM;
1240 1214
1241 list_add(&rdev->same_set, &mddev->disks); 1215 list_add(&rdev->same_set, &mddev->disks);
1242 rdev->mddev = mddev; 1216 rdev->mddev = mddev;
1243 printk(KERN_INFO "md: bind<%s>\n", bdevname(rdev->bdev,b)); 1217 printk(KERN_INFO "md: bind<%s>\n", b);
1244 1218
1245 rdev->kobj.k_name = NULL;
1246 snprintf(rdev->kobj.name, KOBJ_NAME_LEN, "dev%d", rdev->desc_nr);
1247 rdev->kobj.parent = &mddev->kobj; 1219 rdev->kobj.parent = &mddev->kobj;
1248 kobject_add(&rdev->kobj); 1220 kobject_add(&rdev->kobj);
1249 1221