for (d= raid_disks; d < conf->raid_disks; d++) if (conf->mirrors[d].rdev) 
if (raid_disks < conf->raid_disks) { cnt=0; for (d= 0; d < conf->raid_disks; d++) if (conf->mirrors[d].rdev) cnt++; if (cnt > raid_disks) 
static int raid1_reshape(mddev_t *mddev, int raid_disks){	/* We need to:	 * 1/ resize the r1bio_pool	 * 2/ resize conf->mirrors	 *	 * We allocate a new r1bio_pool if we can.	 * Then raise a device barrier and wait until all IO stops.	 * Then resize conf->mirrors and swap in the new r1bio pool.	 */	mempool_t *newpool, *oldpool;	struct pool_info *newpoolinfo;	mirror_info_t *newmirrors;	conf_t *conf = mddev_to_conf(mddev);	int d;	for (d= raid_disks; d < conf->raid_disks; d++)		if (conf->mirrors[d].rdev)			return -EBUSY;	newpoolinfo = kmalloc(sizeof(*newpoolinfo), GFP_KERNEL);	if (!newpoolinfo)		return -ENOMEM;	newpoolinfo->mddev = mddev;	newpoolinfo->raid_disks = raid_disks;	newpool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc,				 r1bio_pool_free, newpoolinfo);	if (!newpool) {		kfree(newpoolinfo);		return -ENOMEM;	}	newmirrors = kmalloc(sizeof(struct mirror_info) * raid_disks, GFP_KERNEL);	if (!newmirrors) {		kfree(newpoolinfo);		mempool_destroy(newpool);		return -ENOMEM;	}	memset(newmirrors, 0, sizeof(struct mirror_info)*raid_disks);	spin_lock_irq(&conf->resync_lock);	conf->barrier++;	wait_event_lock_irq(conf->wait_idle, !conf->nr_pending,			    conf->resync_lock, unplug_slaves(mddev));	spin_unlock_irq(&conf->resync_lock);	/* ok, everything is stopped */	oldpool = conf->r1bio_pool;	conf->r1bio_pool = newpool;	for (d=0; d < raid_disks && d < conf->raid_disks; d++)		newmirrors[d] = conf->mirrors[d];	kfree(conf->mirrors);	conf->mirrors = newmirrors;	kfree(conf->poolinfo);	conf->poolinfo = newpoolinfo;	mddev->degraded += (raid_disks - conf->raid_disks);	conf->raid_disks = mddev->raid_disks = raid_disks;	spin_lock_irq(&conf->resync_lock);	conf->barrier--;	spin_unlock_irq(&conf->resync_lock);	wake_up(&conf->wait_resume);	wake_up(&conf->wait_idle);	set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);	md_wakeup_thread(mddev->thread);	mempool_destroy(oldpool);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/6ea9c07c6c6d1c14d9757dd8470dc4c85bbe9f28/raid1.c/clean/drivers/md/raid1.c