conf->kobj.parent = kobject_get(&mddev->kobj); 
conf->kobj.parent = &mddev->kobj; 
static int run(mddev_t *mddev){	raid5_conf_t *conf;	int raid_disk, memory;	mdk_rdev_t *rdev;	struct disk_info *disk;	struct list_head *tmp;	if (mddev->level != 5 && mddev->level != 4) {		printk("raid5: %s: raid level not set to 4/5 (%d)\n", mdname(mddev), mddev->level);		return -EIO;	}	mddev->private = kmalloc (sizeof (raid5_conf_t)				  + mddev->raid_disks * sizeof(struct disk_info),				  GFP_KERNEL);	if ((conf = mddev->private) == NULL)		goto abort;	memset (conf, 0, sizeof (*conf) + mddev->raid_disks * sizeof(struct disk_info) );	conf->mddev = mddev;	if ((conf->stripe_hashtbl = (struct stripe_head **) __get_free_pages(GFP_ATOMIC, HASH_PAGES_ORDER)) == NULL)		goto abort;	memset(conf->stripe_hashtbl, 0, HASH_PAGES * PAGE_SIZE);	spin_lock_init(&conf->device_lock);	init_waitqueue_head(&conf->wait_for_stripe);	init_waitqueue_head(&conf->wait_for_overlap);	INIT_LIST_HEAD(&conf->handle_list);	INIT_LIST_HEAD(&conf->delayed_list);	INIT_LIST_HEAD(&conf->bitmap_list);	INIT_LIST_HEAD(&conf->inactive_list);	atomic_set(&conf->active_stripes, 0);	atomic_set(&conf->preread_active_stripes, 0);	PRINTK("raid5: run(%s) called.\n", mdname(mddev));	ITERATE_RDEV(mddev,rdev,tmp) {		raid_disk = rdev->raid_disk;		if (raid_disk >= mddev->raid_disks		    || raid_disk < 0)			continue;		disk = conf->disks + raid_disk;		disk->rdev = rdev;		if (rdev->in_sync) {			char b[BDEVNAME_SIZE];			printk(KERN_INFO "raid5: device %s operational as raid"				" disk %d\n", bdevname(rdev->bdev,b),				raid_disk);			conf->working_disks++;		}	}	conf->raid_disks = mddev->raid_disks;	/*	 * 0 for a fully functional array, 1 for a degraded array.	 */	mddev->degraded = conf->failed_disks = conf->raid_disks - conf->working_disks;	conf->mddev = mddev;	conf->chunk_size = mddev->chunk_size;	conf->level = mddev->level;	conf->algorithm = mddev->layout;	conf->max_nr_stripes = NR_STRIPES;	/* device size must be a multiple of chunk size */	mddev->size &= ~(mddev->chunk_size/1024 -1);	mddev->resync_max_sectors = mddev->size << 1;	if (!conf->chunk_size || conf->chunk_size % 4) {		printk(KERN_ERR "raid5: invalid chunk size %d for %s\n",			conf->chunk_size, mdname(mddev));		goto abort;	}	if (conf->algorithm > ALGORITHM_RIGHT_SYMMETRIC) {		printk(KERN_ERR 			"raid5: unsupported parity algorithm %d for %s\n",			conf->algorithm, mdname(mddev));		goto abort;	}	if (mddev->degraded > 1) {		printk(KERN_ERR "raid5: not enough operational devices for %s"			" (%d/%d failed)\n",			mdname(mddev), conf->failed_disks, conf->raid_disks);		goto abort;	}	if (mddev->degraded == 1 &&	    mddev->recovery_cp != MaxSector) {		printk(KERN_ERR 			"raid5: cannot start dirty degraded array for %s\n",			mdname(mddev));		goto abort;	}	{		mddev->thread = md_register_thread(raid5d, mddev, "%s_raid5");		if (!mddev->thread) {			printk(KERN_ERR 				"raid5: couldn't allocate thread for %s\n",				mdname(mddev));			goto abort;		}	}memory = conf->max_nr_stripes * (sizeof(struct stripe_head) +		 conf->raid_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024;	if (grow_stripes(conf, conf->max_nr_stripes)) {		printk(KERN_ERR 			"raid5: couldn't allocate %dkB for buffers\n", memory);		shrink_stripes(conf);		md_unregister_thread(mddev->thread);		goto abort;	} else		printk(KERN_INFO "raid5: allocated %dkB for %s\n",			memory, mdname(mddev));	if (mddev->degraded == 0)		printk("raid5: raid level %d set %s active with %d out of %d"			" devices, algorithm %d\n", conf->level, mdname(mddev), 			mddev->raid_disks-mddev->degraded, mddev->raid_disks,			conf->algorithm);	else		printk(KERN_ALERT "raid5: raid level %d set %s active with %d"			" out of %d devices, algorithm %d\n", conf->level,			mdname(mddev), mddev->raid_disks - mddev->degraded,			mddev->raid_disks, conf->algorithm);	print_raid5_conf(conf);	/* read-ahead size must cover two whole stripes, which is	 * 2 * (n-1) * chunksize where 'n' is the number of raid devices	 */	{		int stripe = (mddev->raid_disks-1) * mddev->chunk_size			/ PAGE_CACHE_SIZE;		if (mddev->queue->backing_dev_info.ra_pages < 2 * stripe)			mddev->queue->backing_dev_info.ra_pages = 2 * stripe;	}	/* Ok, everything is just fine now */	conf->kobj.parent = kobject_get(&mddev->kobj);	strcpy(conf->kobj.name, "raid5");	conf->kobj.ktype = &raid5_ktype;	kobject_register(&conf->kobj);	if (mddev->bitmap)		mddev->thread->timeout = mddev->bitmap->daemon_sleep * HZ;	mddev->queue->unplug_fn = raid5_unplug_device;	mddev->queue->issue_flush_fn = raid5_issue_flush;	mddev->array_size =  mddev->size * (mddev->raid_disks - 1);	return 0;abort:	if (conf) {		print_raid5_conf(conf);		if (conf->stripe_hashtbl)			free_pages((unsigned long) conf->stripe_hashtbl,							HASH_PAGES_ORDER);		kfree(conf);	}	mddev->private = NULL;	printk(KERN_ALERT "raid5: failed to run raid set %s\n", mdname(mddev));	return -EIO;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/9c79197761b4c181a143dc6a6044f4e47d44bdcc/raid5.c/buggy/drivers/md/raid5.c