Running the array means that the array goes from scratch, establishes the attributes (such as synchronous reconstruction) that should be used as a raid, and paves the ground for subsequent reads and writes. So what did you do when you ran the array, making the original disk a new Big Mac like a transformer? Now let's look at the array run process:
5158 static int Do_md_run (struct Mddev *mddev)
5159 {
5160 int err;
5161
5162 err = Md_run (Mddev);
5163 if (err)
5164 goto out;
5165 err = bitmap_load (Mddev);
5166 if (err) {
5167 Bitmap_destroy (mddev);
5168 goto out;
5169 }
5170
5171 md_wakeup_thread (mddev->thread);
5172 Md_wakeup_thread (mddev->sync_thread);/* Possibly kick off a reshape */5173 5174 set_capacity ( Mddev->gendisk, mddev->array_sectors);
5175 Revalidate_disk (mddev->gendisk);
5176 mddev->changed = 1;
5177 kobject_uevent (&disk_to_dev (Mddev->gendisk)->kobj, kobj_change);
5178 out:
5179 return err;
5180}
If the process of running an array is a book, then this function is the directory of the book, each containing a profound story.
5162 lines, Md_run run the array, this function is relatively long, we follow a paragraph to analyze:
4956 int Md_run (struct Mddev *mddev)
4957 {
4958 int err;
4959 struct Md_rdev *rdev;
4960 struct md_personality *pers;
4961
4962 if (List_empty (&mddev->disks))
4963/ * cannot run an array with no devices. * *
4964 return-einval;
4965
4966 if (mddev->pers)
4967 return-ebusy;
4968 /* cannot run until previous stop completes properly /4969 if (mddev->sysfs_active)
4970< C25/>return-ebusy;
4971
4972 / * 4973 * Analyze all RAID superblock (s)
4974/
4975 if (!mddev- >raid_disks) {
4976 if (!mddev->persistent)
4977 return-einval;
4978 Analyze_sbs (mddev);
4979 }