The biggest difference between the
Raid10 run function and the RAID5 run function is setup_conf, which is directly deep into the core:
3540 static struct r10conf *setup_conf (struct Mddev *mddev) 3541 {3542 struct r10conf *conf = NULL;
3543 int err =-einval;
3544 struct Geom Geo;
3545 int copies;
3546 3547 copies = Setup_geo (&geo, Mddev, geo_new); 3548 3549 if (copies = = 2) {3550 PRINTK (kern_err "md/raid10:%s:chunk size must be" 3551 "At least page_size (%LD) and being a power of 2.\n", 3552 mdname (Mddev), Page_
SIZE);
3553 goto out; 3554} 3555 3556 if (Copies < 2 | | copies > mddev->raid_disks) {3557 prin TK (kern_err "md/raid10:%s:unsupported raid10 layout:0x%8x\n", 3558 mdname (Mddev), mddev->new
_layout);
3559 goto out;
3560} 3561 3562 err =-enomem;
3563 conf = kzalloc (sizeof (struct r10conf), gfp_kernel); 3564 if (!conf)
3565 goto out; 3566 3567/* Fixme calc properly/3568 conf->mirrors = kzalloc (sizeof (struct raid10_info) * (mddev-& Gt;raid_disks + 3569 Max (0,-mddev->delta_disks)), 3570
Gfp_kernel);
3571 if (!conf->mirrors) 3572 goto out;
3573 3574 conf->tmppage = Alloc_page (Gfp_kernel);
3575 if (!conf->tmppage) 3576 goto out;
3577 3578 Conf->geo = Geo;
3579 conf->copies = copies; 3580 Conf->r10bio_pool = mempool_create (Nr_raid10_bios, R10bio_pool_alloc, 3581
R10bio_pool_free, conf);
3582 if (!conf->r10bio_pool) 3583 goto out;
3584 3585 calc_sectors (conf, mddev->dev_sectors); 3586 if (mddev->reshape_position = = maxsector) {3587 Conf->prev = conf->geo;
3588 conf->reshape_progress = Maxsector; 3589} else {3590 if (Setup_geo (&conf->prev, Mddev, Geo_old)!= conf->copies) {359
1 err =-einval;
3592 goto out;
3593} 3594 conf->reshape_progress = mddev->reshape_position; 3595 if (conf->prev.far_offset) 3596 conf->prev.stride = 1 << conf-&
Gt;prev.chunk_shift; 3597 Else 3598/* Far_copies must be 1 */3599 CONF->PR
Ev.stride = conf->dev_sectors;
3600} 3601 Spin_lock_init (&conf->device_lock);
3602 Init_list_head (&conf->retry_list);
3603 3604 Spin_lock_init (&conf->resync_lock);
3605 Init_waitqueue_head (&conf->wait_barrier); 3606 3607 conf-≫thread = Md_register_thread (raid10d, Mddev, "RAID10");
3608 if (!conf->thread) 3609 goto out;
3610 3611 Conf->mddev = Mddev; 3612 return conf;