if (info->state & (1<<MD_DISK_WRITEMOSTLY)) set_bit(WriteMostly, &rdev->flags);  
static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info){	char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE];	mdk_rdev_t *rdev;	dev_t dev = MKDEV(info->major,info->minor);	if (info->major != MAJOR(dev) || info->minor != MINOR(dev))		return -EOVERFLOW;	if (!mddev->raid_disks) {		int err;		/* expecting a device which has a superblock */		rdev = md_import_device(dev, mddev->major_version, mddev->minor_version);		if (IS_ERR(rdev)) {			printk(KERN_WARNING 				"md: md_import_device returned %ld\n",				PTR_ERR(rdev));			return PTR_ERR(rdev);		}		if (!list_empty(&mddev->disks)) {			mdk_rdev_t *rdev0 = list_entry(mddev->disks.next,							mdk_rdev_t, same_set);			int err = super_types[mddev->major_version]				.load_super(rdev, rdev0, mddev->minor_version);			if (err < 0) {				printk(KERN_WARNING 					"md: %s has different UUID to %s\n",					bdevname(rdev->bdev,b), 					bdevname(rdev0->bdev,b2));				export_rdev(rdev);				return -EINVAL;			}		}		err = bind_rdev_to_array(rdev, mddev);		if (err)			export_rdev(rdev);		return err;	}	/*	 * add_new_disk can be used once the array is assembled	 * to add "hot spares".  They must already have a superblock	 * written	 */	if (mddev->pers) {		int err;		if (!mddev->pers->hot_add_disk) {			printk(KERN_WARNING 				"%s: personality does not support diskops!\n",			       mdname(mddev));			return -EINVAL;		}		rdev = md_import_device(dev, mddev->major_version,					mddev->minor_version);		if (IS_ERR(rdev)) {			printk(KERN_WARNING 				"md: md_import_device returned %ld\n",				PTR_ERR(rdev));			return PTR_ERR(rdev);		}		/* set save_raid_disk if appropriate */		if (!mddev->persistent) {			if (info->state & (1<<MD_DISK_SYNC)  &&			    info->raid_disk < mddev->raid_disks)				rdev->raid_disk = info->raid_disk;			else				rdev->raid_disk = -1;		} else			super_types[mddev->major_version].				validate_super(mddev, rdev);		rdev->saved_raid_disk = rdev->raid_disk;		rdev->in_sync = 0; /* just to be sure */		rdev->raid_disk = -1;		err = bind_rdev_to_array(rdev, mddev);		if (err)			export_rdev(rdev);		set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);		md_wakeup_thread(mddev->thread);		return err;	}	/* otherwise, add_new_disk is only allowed	 * for major_version==0 superblocks	 */	if (mddev->major_version != 0) {		printk(KERN_WARNING "%s: ADD_NEW_DISK not supported\n",		       mdname(mddev));		return -EINVAL;	}	if (!(info->state & (1<<MD_DISK_FAULTY))) {		int err;		rdev = md_import_device (dev, -1, 0);		if (IS_ERR(rdev)) {			printk(KERN_WARNING 				"md: error, md_import_device() returned %ld\n",				PTR_ERR(rdev));			return PTR_ERR(rdev);		}		rdev->desc_nr = info->number;		if (info->raid_disk < mddev->raid_disks)			rdev->raid_disk = info->raid_disk;		else			rdev->raid_disk = -1;		rdev->faulty = 0;		if (rdev->raid_disk < mddev->raid_disks)			rdev->in_sync = (info->state & (1<<MD_DISK_SYNC));		else			rdev->in_sync = 0;		err = bind_rdev_to_array(rdev, mddev);		if (err) {			export_rdev(rdev);			return err;		}		if (!mddev->persistent) {			printk(KERN_INFO "md: nonpersistent superblock ...\n");			rdev->sb_offset = rdev->bdev->bd_inode->i_size >> BLOCK_SIZE_BITS;		} else 			rdev->sb_offset = calc_dev_sboffset(rdev->bdev);		rdev->size = calc_dev_size(rdev, mddev->chunk_size);		if (!mddev->size || (mddev->size > rdev->size))			mddev->size = rdev->size;	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/8ddf9efe6708f3674f0ddfeb6425fd27bea109a2/md.c/clean/drivers/md/md.c